Event recognition

ABSTRACT

An electronic device executes one or more software elements. Each software element is associated with a particular view, which includes one or more event recognizers. Each event recognizer has one or more event definitions based on one or more sub-events, and an event handler. The event handler is configured to send an action to a target in response to the event recognizer detecting an event corresponding to a particular event definition. The electronic device detects a sequence of sub-events, and identifies actively involved views. The electronic device delivers a respective sub-event to event recognizers for actively involved views. At least one event recognizer for actively involved views has a plurality of event definitions, one of which is selected in accordance with an internal state of the electronic device. The at least one event recognizer processes the respective sub-event in accordance with the selected event definition.

RELATED APPLICATIONS

This application claims priority to U.S. Provisional Application Ser. No. 61/425,222, filed on Dec. 20, 2010, entitled “Event Recognition.” This application is a continuation-in-part of: (A) U.S. patent application Ser. No. 12/566,660, filed Sep. 24, 2009, entitled “Event Recognition,” which claims priority to U.S. Provisional Application Ser. No. 61/210,332, filed on Mar. 16, 2009, entitled “Event Recognition”; and (B) U.S. patent application Ser. No. 12/789,695, filed May 28, 2010, entitled “Gesture Recognizers with Delegates for Controlling and Modifying Gesture Recognition,” which claims priority to U.S. Provisional Application Ser. No. 61/298,531, filed Jan. 26, 2010, entitled “Gesture Recognizers with Delegates for Controlling and Modifying Gesture Recognition.” All of these applications are incorporated by reference herein in their entirety.

This application relates to U.S. patent application Ser. No. 13/077,524 filed Mar. 31, 2011, entitled “Device, Method, and Graphical User Interface for Navigation of Concurrently Open Software Applications”. This application is incorporated by reference herein in its entirety.

This application relates to U.S. patent application Ser. No. 13/077,925, filed Mar. 31, 2011, entitled “Event Recognition”; and U.S. patent application Ser. No. 13/077,927, filed Mar. 31, 2011, entitled “Event Recognition”. Both of these applications are incorporated by reference herein in their entirety.

TECHNICAL FIELD

This relates generally to user interface processing, including but not limited to, apparatuses and methods for recognizing touch inputs.

BACKGROUND

An electronic device typically includes a user interface that is used to interact with the computing device. The user interface may include a display and/or input devices such as a keyboard, mice, and touch-sensitive surfaces for interacting with various aspects of the user interface. In some devices with a touch-sensitive surface as an input device, a first set of touch-based gestures (e.g., two or more of: tap, double tap, horizontal swipe, vertical swipe, pinch, depinch, two finger swipe) are recognized as proper inputs in a particular context (e.g., in a particular mode of a first application), and other, different sets of touch-based gestures are recognized as proper inputs in other contexts (e.g., different applications and/or different modes or contexts within the first application). As a result, the software and logic required for recognizing and responding to touch-based gestures can become complex, and can require revision each time an application is updated or a new application is added to the computing device. These and similar issues may arise in user interfaces that utilize input sources other than touch-based gestures.

Thus, it would be desirable to have a comprehensive framework or mechanism for recognizing touch-based gestures and events, as well as gestures and events from other input sources, that is easily adaptable to virtually all contexts or modes of all application programs on a computing device, and that requires little or no revision when an application is updated or a new application is added to the computing device.

SUMMARY

To address the aforementioned drawbacks, some embodiments provide a method performed at an electronic device with a touch-sensitive display. The electronic device is configured to execute at least a first software application and a second software application. The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. The method includes displaying at least a subset of the one or more views of the second software application, and while displaying at least the subset of the one or more views of the second software application, detecting a sequence of touch inputs on the touch-sensitive display. The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion. The method also includes, during a first phase of detecting the sequence of touch inputs, delivering the first portion of one or more touch inputs to the first software application and the second software application, identifying from gesture recognizers in the first set one or more matching gesture recognizers that recognize the first portion of one or more touch inputs, and processing the first portion of one or more touch inputs with one or more gesture handlers corresponding to the one or more matching gesture recognizers.

In accordance with some embodiments, a method is performed at an electronic device with a touch-sensitive display. The electronic device is configured to execute at least a first software application and a second software application. The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. The method includes displaying a first set of one or more views. The first set of one or more views includes at least a subset of the one or more views of the second software application. The method also includes, while displaying the first set of the one or more views, detecting a sequence of touch inputs on the touch-sensitive display. The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion. The method includes determining whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs. The method also includes, in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs, delivering the sequence of touch inputs to the first software application without delivering the sequence of touch inputs to the second software application, and determining whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs. The method furthermore includes, in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs, processing the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers that recognizes the sequence of touch inputs. The method also includes, in accordance with a determination that no gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs, delivering the sequence of touch inputs to the second software application, and determining whether at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs. The method furthermore includes, in accordance with a determination that at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs, processing the sequence of touch inputs with the at least one gesture recognizer in the second set of one or more gesture recognizers that recognizes the sequence of touch inputs.

In accordance with some embodiments, a method is performed at an electronic device with an internal state. The electronic device is configured to execute software that includes a view hierarchy with a plurality of views. The method includes displaying one or more views of the view hierarchy, and executing one or more software elements. Each software element is associated with a particular view, and each particular view includes one or more event recognizers. Each event recognizer has one or more event definitions based on one or more sub-events, and an event handler, which specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions. The method also includes detecting a sequence of one or more sub-events, and identifying one of the views of the view hierarchy as a hit view. The hit view establishes which views in the view hierarchy are actively involved views. The method furthermore includes delivering a respective sub-event to event recognizers for each actively involved view within the view hierarchy. At least one event recognizer for actively involved views in the view hierarchy has a plurality of event definitions, and one in the plurality of event definitions is selected in accordance with the internal state of the electronic device. The at least one event recognizer processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition.

In accordance with some embodiments, a non-transitory computer readable storage medium stores one or more programs for execution by one of more processors of an electronic device. The one or more programs include one or more instructions, which when executed by the electronic device, cause the device to perform any of the methods described above.

In accordance with some embodiments, an electronic device with a touch-sensitive display includes one or more processors, and memory storing one or more programs for execution by the one or more processors. The one or more programs include instructions for implementing any of the methods described above.

In accordance with some embodiments, an electronic device with a touch-sensitive display includes means for implementing any of the methods described above.

In accordance with some embodiments, an information processing apparatus in a multifunction device with a touch-sensitive display includes means for implementing any of the methods described above.

In accordance with some embodiments, an electronic device includes a touch-sensitive display unit configured to receive touch inputs, and a processing unit coupled to the touch-sensitive display unit. The processing unit is configured to execute at least a first software application and a second software application. The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. The processing unit is configured to: enable display of at least a subset of the one or more views of the second software application; and while displaying at least the subset of the one or more views of the second software application, detect a sequence of touch inputs on the touch-sensitive display unit. The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion. The processing unit is configured to, during a first phase of detecting the sequence of touch inputs: deliver the first portion of one or more touch inputs to the first software application and the second software application; identify from gesture recognizers in the first set one or more matching gesture recognizers that recognize the first portion of one or more touch inputs; and process the first portion of one or more touch inputs with one or more gesture handlers corresponding to the one or more matching gesture recognizers.

In accordance with some embodiments, an electronic device includes a touch-sensitive display unit configured to receive touch inputs, and a processing unit coupled to the touch-sensitive display unit. The processing unit is configured to execute at least a first software application and a second software application. The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. The processing unit is configured to enable display of a first set of one or more views. The first set of one or more views includes at least a subset of the one or more views of the second software application. The processing unit is configured to, while displaying the first set of the one or more views: detect a sequence of touch inputs on the touch-sensitive display unit (the sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion); and determine whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs. The processing unit is configured to, in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs: deliver the sequence of touch inputs to the first software application without delivering the sequence of touch inputs to the second software application; and determine whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs. The processing unit is configured to, in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs, process the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers that recognizes the sequence of touch inputs. The processing unit is configured to, in accordance with a determination that no gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs: deliver the sequence of touch inputs to the second software application; determine whether at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs; and in accordance with a determination that at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs, process the sequence of touch inputs with the at least one gesture recognizer in the second set of one or more gesture recognizers that recognizes the sequence of touch inputs.

In accordance with some embodiments, an electronic device includes: a display unit configured to display one or more views; a memory unit configured to store an internal state; and a processing unit coupled to the display unit and the memory unit. The processing unit is configured to: execute software that includes a view hierarchy with a plurality of views; enable display of one or more views of the view hierarchy; and execute one or more software elements. Each software element is associated with a particular view, and each particular view includes one or more event recognizers. Each event recognizer has: one or more event definitions based on one or more sub-events, and an event handler. The event handler specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions. The processing unit is configured to: detect a sequence of one or more sub-events; and identify one of the views of the view hierarchy as a hit view. The hit view establishes which views in the view hierarchy are actively involved views. The processing unit is configured to deliver a respective sub-event to event recognizers for each actively involved view within the view hierarchy. At least one event recognizer for actively involved views in the view hierarchy has a plurality of event definitions, one of which is selected in accordance with the internal state of the electronic device, and the at least one event recognizer processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A-1C are block diagrams illustrating electronic devices in accordance with some embodiments.

FIG. 2 is a diagram of an input/output processing stack of an exemplary electronic device in accordance with some embodiments.

FIG. 3A illustrates an exemplary view hierarchy in accordance with some embodiments.

FIGS. 3B and 3C are block diagrams illustrating exemplary event recognizer methods and data structures in accordance with some embodiments.

FIG. 3D is a block diagram illustrating exemplary components for event handling in accordance with some embodiments.

FIG. 3E is a block diagram illustrating exemplary classes and instances of gesture recognizers in accordance with some embodiments.

FIG. 3F is a block diagram illustrating the flow of event information in accordance with some embodiments.

FIGS. 4A and 4B are flow charts illustrating exemplary state machines in accordance with some embodiments.

FIG. 4C illustrates the exemplary state machines of FIGS. 4A and 4B to an exemplary set of sub-events in accordance with some embodiments.

FIGS. 5A-5C illustrate exemplary sub-event sequences with exemplary event recognizer state machines in accordance with some embodiments.

FIGS. 6A and 6B are event recognition method flow diagrams in accordance with some embodiments.

FIGS. 7A-7S illustrate exemplary user interfaces and user inputs recognized by event recognizers for navigating through concurrently open applications in accordance with some embodiments.

FIGS. 8A and 8B are flow diagrams illustrating an event recognition method in accordance with some embodiments.

FIGS. 9A-9C are flow diagrams illustrating an event recognition method in accordance with some embodiments.

FIGS. 10A-10B are flow diagrams illustrating an event recognition method in accordance with some embodiments.

FIG. 11 is a functional block diagram of an electronic device in accordance with some embodiments.

FIG. 12 is a functional block diagram of an electronic device in accordance with some embodiments.

FIG. 13 is a functional block diagram of an electronic device in accordance with some embodiments.

Like reference numerals refer to corresponding parts throughout the drawings.

DESCRIPTION OF EMBODIMENTS

Electronic devices with small screens (e.g., smart phones and tablets) typically display a single application at a time, even though multiple applications may be running on the device. Many of these devices have touch-sensitive displays configured to receive gesture as touch inputs. With such devices, a user may want to perform operations that are provided by a hidden application (e.g., an application that is running in the background and is not currently displayed on the display of the electronic device, such as an application launcher software application running in the background). Existing methods for performing operations provided by a hidden application typically require first displaying the hidden application and then providing touch inputs to the now displayed application. Therefore, the existing methods require additional steps. Furthermore, the user may not want to see the hidden application, but yet still want to perform an operation provided by the hidden application. In the embodiments described below, improved methods for interacting with a hidden application is achieved by delivering touch inputs to the hidden application, and processing the touch inputs with the hidden application without displaying the hidden application. Thus, these methods streamline the interaction with a hidden application, thereby eliminating the need for extra, separate steps to display the hidden application, while providing the ability to control and interact with the hidden application based on a gesture input.

In addition, in some embodiments, such electronic devices have at least one gesture recognizer with a plurality of gesture definitions. This helps the gesture recognizer work in different distinct operating modes. For example, a device may have a normal operating mode and an accessibility operating mode (e.g., for people with limited vision). In the normal operating mode, a next application gesture is used to move between applications, and the next application gesture is defined as a three-finger left-swipe gesture. In the accessibility operating mode, the three-finger left-swipe gesture is used to perform a different function. Thus, a gesture different from the three-finger left-swipe is needed in the accessibility operating mode to correspond to the next application gesture (e.g., a four-finger left-swipe gesture in the accessibility operating mode). By having multiple gesture definitions associated with the next application gesture, the device can select one of the gesture definitions for the next application gesture, depending on the current operating mode. This provides flexibility in using the gesture recognizer in different operating modes. In some embodiments, a plurality of gesture recognizers with multiple gesture definitions is adjusted depending on the operating mode (e.g., gestures performed with three fingers in the normal operating mode are performed with four fingers in the accessibility operating mode).

Below, FIGS. 1A-1C and 2 provide a description of exemplary devices. FIGS. 3A-3F describe components for event handling and the operation (e.g., flow of event information) of such components. FIGS. 4A-4C and 5A-5C describe operations of event recognizers in more detail. FIGS. 6A-6B are flow diagrams illustrating event recognition methods. FIGS. 7A-7S are exemplary user interfaces illustrating operations using event recognition methods in FIGS. 8A-8B, 9A-9C, and 10. FIGS. 8A-8B are flow diagrams illustrating an event recognition method of processing the event information with a gesture handler of a hidden open application. FIGS. 9A-9C are flow diagrams illustrating an event recognition method of conditionally processing the event information with a gesture recognizer of a hidden open application or a displayed application. FIG. 10 is a flow diagram illustrating an event recognition method of selecting an event definition of a plurality of event definitions for a single event recognizer.

Reference will now be made in detail to embodiments, examples of which are illustrated in the accompanying drawings. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, components, circuits, and networks have not been described in detail so as not to unnecessarily obscure aspects of the embodiments.

It will also be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first contact could be termed a second contact, and, similarly, a second contact could be termed a first contact, without departing from the scope of the present invention. The first contact and the second contact are both contacts, but they are not the same contact.

The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the description of the invention and the appended claims, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in response to detecting,” depending on the context. Similarly, the phrase “if it is determined” or “if [a stated condition or event] is detected” may be construed to mean “upon determining” or “in response to determining” or “upon detecting (the stated condition or event)” or “in response to detecting (the stated condition or event),” depending on the context.

As used herein, the term “event” refers to an input detected by one or more sensors of the device. In particular, the term “event” includes a touch on a touch-sensitive surface. An event comprises one or more sub-events. Sub-events typically refer to changes to an event (e.g., a touch-down, touch-move, and lift-off of the touch can be sub-events). Sub-events in the sequence of one or more sub-events can include many forms, including without limitation, key presses, key press holds, key press releases, button presses, button press holds, button press releases, joystick movements, mouse movements, mouse button presses, mouse button releases, pen stylus touches, pen stylus movements, pen stylus releases, oral instructions, detected eye movements, biometric inputs, and detected physiological changes in a user, among others. Since an event may comprise a single sub-event (e.g., a short lateral motion of the device), the term “sub-event” as used herein also refers to an event.

As used herein, the terms “event recognizer” and “gesture recognizer” are used interchangeably to refer to a recognizer that can recognize a gesture or other events (e.g., motion of the device). As used herein, the terms “event handler” and “gesture handler” are used interchangeably to refer to a handler that performs a predefined set of operations (e.g., updating data, updating object(s), and/or updating display) in response to recognition of an event/sub-event or a gesture.

As noted above, in some devices with a touch-sensitive surface as an input device, a first set of touch-based gestures (e.g., two or more of: tap, double tap, horizontal swipe, vertical swipe) are recognized as proper inputs in a particular context (e.g., in a particular mode of a first application), and other, different sets of touch-based gestures are recognized as proper inputs in other contexts (e.g., different applications and/or different modes or contexts within the first application). As a result, the software and logic required for recognizing and responding to touch-based gestures can become complex, and can require revision each time an application is updated or a new application is added to the computing device. Embodiments described herein address these problems by providing a comprehensive framework for handling events and/or gesture inputs.

In the embodiments described below, touch-based gestures are events. Upon recognition of a predefined event, e.g., an event that corresponds to a proper input in the current context of an application, information concerning the event is delivered to the application. Furthermore, each respective event is defined as a sequence of sub-events. In devices that have a multi-touch display device (often herein called “screens”) or other multi-touch sensitive surface, and that accept multi-touch-based gestures, the sub-events that define a multi-touched based event may include multi-touch sub-events (requiring two or more fingers to be simultaneously in contact with the device's touch-sensitive surface). For example, in a device having a multi-touch sensitive display, a respective multi-touch sequence of sub-events may begin when a user's finger first touches the screen. Additional sub-events may occur when one or more additional fingers subsequently or concurrently touch the screen, and yet other sub-events may occur when all of the fingers touching the screen move across the screen. The sequence ends when the last of the user's fingers is lifted from the screen.

When using touch-based gestures to control an application running in a device having a touch-sensitive surface, touches have both temporal and spatial aspects. The temporal aspect, called a phase, indicates when a touch has just begun, whether it is moving or stationary, and when it ends—that is, when the finger is lifted from the screen. A spatial aspect of a touch is the set of views or user interface windows in which the touch occurs. The views or windows in which a touch is detected may correspond to programmatic levels within a programmatic or view hierarchy. For example, the lowest level view in which a touch is detected may be called the hit view, and the set of events that are recognized as proper inputs may be determined based, at least in part, on the hit view of the initial touch that begins a touch-based gesture. Alternatively, or additionally, events are recognized as proper inputs based, at least in part, on one or more software programs (i.e., software applications) in the programmatic hierarchy. For example, a five-finger pinch gesture is recognized as a proper input in an application launcher that has a five-finger pinch gesture recognizer, but not in a web browser application that does not have the five-finger pinch gesture recognizer.

FIGS. 1A-1C are block diagrams illustrating different embodiments of electronic device 102, in accordance with some embodiments. Electronic device 102 may be any electronic device including, but not limited to, a desktop computer system, a laptop computer system, a mobile phone, a smart phone, a personal digital assistant, or a navigation system. Electronic device 102 may also be a portable electronic device with a touch screen display (e.g., touch-sensitive display 156, FIG. 1B) configured to present a user interface, a computer with a touch screen display configured to present a user interface, a computer with a touch sensitive surface and a display configured to present a user interface, or any other form of computing device, including without limitation, consumer electronic devices, mobile telephones, video game systems, electronic music players, tablet PCs, electronic book reading systems, e-books, PDAs, electronic organizers, email devices, laptops or other computers, kiosk computers, vending machines, smart appliances, etc. Electronic device 102 includes user interface 113.

In some embodiments, electronic device 102 includes a touch-sensitive display 156 (FIG. 1B). In these embodiments, user interface 113 may include an on-screen keyboard (not depicted) that is used by a user to interact with electronic device 102. In some embodiments, electronic device 102 also includes one or more input devices 128 (e.g., keyboard, mouse, trackball, microphone, physical button(s), touchpad, etc.). In some embodiments, touch-sensitive display 156 has the ability to detect two or more distinct, concurrent (or partially concurrent) touches, and in these embodiments, display 156 is sometimes herein called a multitouch display or multitouch-sensitive display. In some embodiments, a keyboard of the one or more input devices 128 may be separate and distinct from electronic device 102. For example, a keyboard may be a wired or wireless keyboard coupled to electronic device 102.

In some embodiments, electronic device 102 includes display 126 and one or more input devices 128 (e.g., keyboard, mouse, trackball, microphone, physical button(s), touchpad, trackpad, etc.) that are coupled to electronic device 102. In these embodiments, one or more of input devices 128 may optionally be separate and distinct from electronic device 102. For example, the one or more input devices may include one or more of: a keyboard, a mouse, a trackpad, a trackball, and an electronic pen, any of which may optionally be separate from the electronic device. Optionally, device 102 may include one or more sensors 116, such as one or more accelerometers, gyroscopes, GPS systems, speakers, infrared (IR) sensors, biometric sensors, cameras, etc. It is noted that the description above of various exemplary devices as input devices 128 or as sensors 116 is of no significance to the operation of the embodiments described herein, and that any input or sensor device described herein as an input device may equally well be described as a sensor, and vice versa. In some embodiments, signals produced by one or more sensors 116 are used as input sources for detecting events.

In some embodiments, electronic device 102 includes touch-sensitive display 156 (i.e., a display having a touch-sensitive surface) and one or more input devices 128 that are coupled to electronic device 102 (FIG. 1B). In some embodiments, touch-sensitive display 156 has the ability to detect two or more distinct, concurrent (or partially concurrent) touches, and in these embodiments, display 156 is sometimes herein called a multitouch display or multitouch-sensitive display.

In some embodiments of electronic device 102 discussed herein, input devices 128 are disposed in electronic device 102. In other embodiments, one or more of input devices 128 is separate and distinct from electronic device 102. For example, one or more of input devices 128 may be coupled to electronic device 102 by a cable (e.g., USB cable) or wireless connection (e.g., Bluetooth connection).

When using input devices 128, or when performing a touch-based gesture on touch-sensitive display 156 of electronic device 102, the user generates a sequence of sub-events that are processed by one or more CPUs 110 of electronic device 102. In some embodiments, one or more CPUs 110 of the electronic device 102 process the sequence of sub-events to recognize events.

Electronic device 102 typically includes one or more single- or multi-core processing units (“CPU” or “CPUs”) 110 as well as one or more network or other communications interfaces 112. Electronic device 102 includes memory 111 and one or more communication buses 115 for interconnecting these components. Communication buses 115 may include circuitry (sometimes called a chipset) that interconnects and controls communications between system components (not depicted herein). As discussed above, electronic device 102 includes user interfaces 113 including a display (e.g., display 126 or touch-sensitive display 156). Further, electronic device 102 typically includes input devices 128 (e.g., keyboard, mouse, touch sensitive surfaces, keypads, etc.). In some embodiments, the input devices 128 include an on-screen input device (e.g., a touch-sensitive surface of a display device). Memory 111 may include high-speed random access memory, such as DRAM, SRAM, DDR RAM or other random access solid state memory devices; and may include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile solid state storage devices. Memory 111 may optionally include one or more storage devices remotely located from the CPU(s) 110. Memory 111, or alternately the non-volatile memory device(s) within memory 111, comprise a computer readable storage medium. In some embodiments, memory 111, or the non-volatile memory device(s) within memory 111, comprises a non-transitory computer readable storage medium. In some embodiments, memory 111 (of electronic device 102) or the computer readable storage medium of memory 111 stores the following programs, modules and data structures, or a subset thereof:

-   -   operating system 118, which includes procedures for handling         various basic system services and for performing hardware         dependent tasks;     -   accessibility module 127 (FIG. 1C), which is used for modifying         behavior of one or more software applications in application         software 124 or modifying data from touch-sensitive display 156         or input device(s) 128 to improve accessibility of the one or         more software applications in application software 124 or         accessibility to content (e.g., a web page) displayed therein         (e.g., for people with impaired vision or limited motion         capabilities);     -   communication module 120, which is used for connecting         electronic device 102 to other devices via one or more         respective communication interfaces 112 (wired or wireless) and         one or more communication networks, such as the Internet, other         wide area networks, local area networks, metropolitan area         networks, and so on;     -   user interface module 123 (FIG. 1C), which is used for         displaying user interfaces including user interface objects on         display 126 or touch-sensitive display 156;     -   control application 132 (FIG. 1C), which is used for controlling         processes (e.g., hit view determination, thread management,         and/or event monitoring, etc.); in some embodiments, control         application 132 includes a run-time application; in other         embodiments, the run-time application includes control         application 132;     -   event delivery system 122, which may be implemented in various         alternate embodiments within operating system 118 or in         application software 124; in some embodiments, however, some         aspects of event delivery system 122 may be implemented in         operating system 118 while other aspects are implemented in         application software 124;     -   application software 124, which includes one or more software         applications (e.g., applications 133-1, 133-2, and 133-3 in FIG.         1C, each of which can be one of: an email application, a web         browser application, a notes application, a text messaging         application, etc.); a respective software application typically         has, at least during execution, an application state, indicating         the state of the respective software application and its         components (e.g., gesture recognizers); see application internal         state 321 (FIG. 3D) described below; and     -   device/global internal state 134 (FIG. 1C), which includes one         or more of: application state, indicating the state of software         applications and their components (e.g., gesture recognizers and         delegates); display state, indicating what applications, views         or other information occupy various regions of touch-sensitive         display 156 or display 126; sensor state, including information         obtained from the device's various sensors 116, input devices         128, and/or touch-sensitive display 156; location information         concerning the device's location and/or attitude; and other         states.

As used in the specification and claims, the term “open application” refers to a software application with retained state information (e.g., as part of device/global internal state 134 and/or application internal state 321 (FIG. 3D)). An open application is any one of the following types of applications:

-   -   an active application, which is currently displayed on display         126 or touch-sensitive display 156 (or a corresponding         application view is currently displayed on the display);     -   a background application (or background process), which is not         currently displayed on display 126 or touch-sensitive display         156, but one or more application processes (e.g., instructions)         for the corresponding application are being processed by one or         more processors 110 (i.e., running);     -   a suspended application, which is not currently running, and the         application is stored in a volatile memory (e.g., DRAM, SRAM,         DDR RAM, or other volatile random access solid state memory         device of memory 111); and     -   a hibernated application, which is not running, and the         application is stored in a non-volatile memory (e.g., one or         more magnetic disk storage devices, optical disk storage         devices, flash memory devices, or other non-volatile solid state         storage devices of memory 111).

As used herein, the term “closed application” refers to software applications without retained state information (e.g., state information for closed applications is not stored in a memory of the device). Accordingly, closing an application includes stopping and/or removing application processes for the application and removing state information for the application from the memory of the device. Generally, opening a second application while in a first application does not close the first application. When the second application is displayed and the first application ceases to be displayed, the first application, which was an active application when displayed, may become a background application, suspended application, or hibernated application, but the first application remains an open application while its state information is retained by the device.

Each of the above identified elements may be stored in one or more of the previously mentioned memory devices. Each of the above identified module, application or system elements corresponds to a set of instructions for performing functions described herein. The set of instructions can be executed by one or more processors (e.g., one or more CPUs 110). The above identified modules or programs (i.e., sets of instructions) need not be implemented as separate software programs, procedures or modules, and thus various subsets of these modules may be combined or otherwise rearranged in various embodiments. In some embodiments, memory 111 may store a subset of the modules and data structures identified above. Furthermore, memory 111 may store additional modules and data structures not described above.

FIG. 2 is a diagram of input/output processing stack 200 of an exemplary electronic device or apparatus (e.g., device 102) according to some embodiments of the invention. Hardware (e.g., electronic circuitry) 212 of the device is at the base level of the input/output processing stack 200. Hardware 212 can include various hardware interface components, such as the components depicted in FIGS. 1A and/or 1B. Hardware 212 can also include one or more of above mentioned sensors 116. At least some of the other elements (202-210) of input/output processing stack 200 are software procedures, or portions of software procedures, that process inputs received from hardware 212 and generate various outputs that are presented through a hardware user interface (e.g., one or more of a display, speakers, device vibration actuator, etc.).

A driver or a set of drivers 210 communicates with hardware 212. Drivers 210 can receive and process input data received from hardware 212. Core Operating System (“OS”) 208 can communicate with driver(s) 210. Core OS 208 can process raw input data received from driver(s) 210. In some embodiments, drivers 210 can be considered to be a part of core OS 208.

A set of OS application programming interfaces (“OS APIs”) 206, are software procedures that communicate with core OS 208. In some embodiments, APIs 206 are included in the device's operating system, but at a level above core OS 208. APIs 206 are designed for use by applications running on the electronic devices or apparatuses discussed herein. User interface (UI) APIs 204 can utilize OS APIs 206. Application software (“applications”) 202 running on the device can utilize UI APIs 204 in order to communicate with the user. UI APIs 204 can, in turn, communicate with lower level elements, ultimately communicating with various user interface hardware, e.g., multitouch display 156. In some embodiments, application software 202 includes applications in application software 124 (FIG. 1A).

While each layer input/output processing stack 200 can utilize the layer underneath it, that is not always required. For example, in some embodiments, applications 202 may directly communicate with OS APIs 206. In general, layers at or above OS API layer 206 may not directly access Core OS 208, driver(s) 210, or hardware 212, as these layers are considered private. Applications in layer 202 and UI API 204 usually direct calls to the OS API 206, which in turn, accesses the layers Core OS 208, driver(s) 210, and hardware 212.

Stated in another way, one or more hardware elements 212 of electronic device 102, and software running on the device detect input events (which may correspond to sub-events in a gesture) at one or more of the input device(s) 128 and/or a touch-sensitive display 156 and generate or update various data structures (stored in memory 111 of device 102) used by a set of currently active event recognizers to determine whether and when the input events correspond to an event to be delivered to application 124. Embodiments of event recognition methodologies, apparatus and computer program products are described in more detail below.

FIG. 3A depicts an exemplary view hierarchy 300, which in this example is a search program displayed in outermost view 302. Outermost view 302 generally encompasses the entire user interface a user may directly interact with, and includes subordinate views, e.g.,

-   -   search results panel 304, which groups search results and can be         scrolled vertically;     -   search field 306, which accepts text inputs; and     -   a home row 310, which groups applications for quick access.

In this example, each subordinate view includes lower-level subordinate views. In other examples, the number of view levels in the hierarchy 300 may differ in different branches of the hierarchy, with one or more subordinate views having lower-level subordinate views, and one or more other subordinate views not have any such lower-level subordinate views. Continuing with the example shown in FIG. 3A, search results panel 304 contains separate subordinate views 305 (subordinate to panel 304) for each search result. Here, this example shows one search result in a subordinate view called the maps view 305. Search field 306 includes a subordinate view herein called clear contents icon view 307, which clears the contents of the search field when a user performs a particular action (e.g., a single touch or tap gesture) on the clear contents icon in view 307. Home row 310 includes subordinate views 310-1, 310-2, 310-3, and 310-4, which respectively correspond to a contacts application, an email application, a web browser, and an iPod music interface.

A touch sub-event 301-1 is represented in outermost view 302. Given the location of touch sub-event 301-1 over both the search results panel 304, and maps view 305, the touch sub-event is also represented over those views as 301-2 and 301-3, respectively. Actively involved views of the touch sub-event include the views search results panel 304, maps view 305 and outermost view 302. Additional information regarding sub-event delivery and actively involved views is provided below with reference to FIGS. 3B and 3C.

Views (and corresponding programmatic levels) can be nested. In other words, a view can include other views. Consequently, the software element(s) (e.g., event recognizers) associated with a first view can include or be linked to one or more software elements associated with views within the first view. While some views can be associated with applications, others can be associated with high level OS elements, such as graphical user interfaces, window managers, etc. In some embodiments, some views are associated with other OS elements. In some embodiments, the view hierarchy includes views from a plurality of software applications. For example, the view hierarchy may include a view from an application launcher (e.g., a home screen) and a view from a web browser application (e.g., a view including content of a web page).

A programmatic hierarchy includes one or more software elements or software applications in a hierarchy. To simplify subsequent discussion, reference will generally be made only to views and the view hierarchy, but it must be understood that in some embodiments, the method may operate with a programmatic hierarchy with a plurality of programmatic layers, and/or a view hierarchy.

FIGS. 3B and 3C depict exemplary methods and structures related to event recognizers. FIG. 3B depicts methods and data structures for event handling when event handlers are associated with particular views within a hierarchy of views. FIG. 3C depicts methods and data structures for event handling when event handlers are associated with particular levels within a hierarchy of programmatic levels. Event recognizer global methods 312 and 350 include hit view and hit level determination modules 314 and 352, respectively, active event recognizer determination modules 316 and 354, and sub-event delivery modules 318 and 356.

In some embodiments, electronic device 102 includes one or more of: event recognizer global methods 312 and 350. In some embodiments, electronic device 102 includes one or more of: hit view determination module 314 and hit level determination module 352. In some embodiments, electronic device 102 includes one or more of: active event recognizer determination modules 316 and 354. In some embodiments, electronic device 102 includes one or more of: sub-event delivery modules 318 and 356. In some embodiments, one or more of these methods and modules are included in fewer or more methods and modules. For example, in some embodiments, electronic device 102 includes a hit view/level determination module which includes the functionality of hit view determination module 314 and hit level determination module 352. In some embodiments, electronic device 102 includes an active event recognizer determination module which includes the functionality of active event recognizer determination modules 316 and 354.

Hit view and hit level determination modules, 314 and 352, respectively, provide software procedures for determining where a sub-event has taken place within one or more views (e.g., the exemplary view hierarchy 300 depicted in FIG. 3A, which has three main branches) and/or one or more software elements in the programmatic hierarchy that correspond to the sub-event (e.g., one or more of applications 133 in FIG. 1C).

The hit view determination module 314 of FIG. 3B, receives information related to a sub-event, e.g., a user touch represented as 301-1 on the outermost view 302, on a search result (maps view 305) and the search results panel view 304. The hit view determination module 314 identifies a hit-view as the lowest view in the hierarchy which should handle the sub-event. In most circumstances, the hit view is the lowest level view in which an initiating sub-event (i.e., the first sub-event in the sequence of sub-events that form an event or potential event) occurs. In some embodiments, once the hit-view is identified, it will receive all sub-events related to the same touch or input source for which the hit view was identified. In some embodiments, one or more other views (e.g., a default or predefined view) receive at least some of the sub-events that the hit view receives.

In some embodiments, the hit level determination module 352 of FIG. 3C may utilize an analogous process. For example, in some embodiments, the hit level determination module 352 identifies a hit level as the lowest level in the programmatic hierarchy (or a software application in the lowest programmatic level in the programmatic hierarchy) which should handle the sub-event. In some embodiments, once the hit level is identified, it or a software application in the hit level will receive all sub-events related to the same touch or input source for which the hit level was identified. In some embodiments, one or more other levels or software applications (e.g., a default or predefined software application) receive at least some of the sub-events that the hit view receives.

Active event recognizer determination modules 316 and 354 of event recognizer global methods 312 and 350, respectively, determine which view or views within a view hierarchy and/or a programmatic hierarchy should receive a particular sequence of sub-events. FIG. 3A depicts an exemplary set of active views, 302, 304 and 305, that receive the sub-event 301. In the example of FIG. 3A, the active event recognizer determination module 316 would determine that the outermost view 302, search results panel 304 and maps view 305 are actively involved views because these views include the physical location of the touch represented by sub-event 301. It is noted that even if touch sub-event 301 were entirely confined to the area associated with maps view 305, search results panel 304 and outermost view 302 would still remain in the actively involved views since the search results panel 304 and outermost view 302 are ancestors of maps view 305.

In some embodiments, active event recognizer determination modules 316 and 354 utilize analogous processes. In the example of FIG. 3A, the active event recognizer determination module 350 would determine that the map application is actively involved because the views of the map application are displayed and/or the views of the map application include the physical location of the touch represented by sub-event 301. It is noted that even if touch sub-event 301 were entirely confined to the area associated with the map application, other applications in the programmatic hierarchy may still remain as actively involved applications (or applications in the actively involved programmatic levels).

Sub-event delivery module 318 delivers sub-events to event recognizers for actively involved views. Using the example of FIG. 3A, a user's touch is represented in different views of the hierarchy by touch marks 301-1, 301-2, and 301-3. In some embodiments, sub-event data representing this user's touch is delivered by the sub-event delivery module 318 to event recognizers at the actively involved views, i.e., top level view 302, search results panel 304 and maps view 305. Further, the event recognizers of a view can receive subsequent sub-events of an event that starts within the view (e.g., when an initial sub-event occurs within the view). Stated in another way, a view can receive sub-events associated with user interactions beginning in the view, even if it continues outside of the view.

In some embodiments, sub-event delivery module 356 delivers sub-events to event recognizers for actively involved programmatic levels in a process analogous to that used by sub-event delivery module 318. For example, sub-event delivery module 356 delivers sub-events to event recognizers for actively involved applications. Using the example of FIG. 3A, a user's touch 301 is delivered by sub-event delivery module 356 to event recognizers at the actively involved views (e.g., the map application and any other actively involved applications in the programmatic hierarchy). In some embodiments, a default or predefined software application is included in the programmatic hierarchy by default.

In some embodiments, a separate event recognizer structure 320 or 360 is generated and stored in memory of the device for each actively involved event recognizer Event recognizer structures 320 and 360 typically include an event recognizer state 334, 374, respectively (discussed in greater detail below when referring to FIGS. 4A and 4B), and event recognizer specific code 338, 378, respectively, having state machines 340, 380, respectively. Event recognizer structure 320 also includes a view hierarchy reference 336, while event recognizer structure 360 includes a programmatic hierarchy reference 376. Each instance of a particular event recognizer references exactly one view or programmatic level. View hierarchy reference 336 or programmatic hierarchy reference 376 (for a particular event recognizer) is used to establish which view or programmatic level is logically coupled to the respective event recognizer.

View metadata 341 and level metadata 381 may include data regarding a view or level, respectively. View or level metadata may include at least the following properties that may influence sub-event delivery to event recognizers:

-   -   A stop property 342, 382, which, when set for a view or         programmatic level prevents sub-event delivery to event         recognizers associated with the view or programmatic level as         well as its ancestors in the view or programmatic hierarchy.     -   A skip property 343, 383, which, when set for a view or         programmatic level prevents sub-event delivery to event         recognizers associated with that view or programmatic level, but         permits sub-event delivery to its ancestors in the view or         programmatic hierarchy.     -   A NoHit skip property 344, 384, which, when set for a view,         prevents delivery of sub-events to event recognizers associated         with the view unless the view is the hit view. As discussed         above, the hit view determination module 314 identifies a         hit-view (or hit level in the case of hit level determination         module 352) as the lowest view in the hierarchy which should         handle the sub-event.

Event recognizer structures 320 and 360 may include metadata 322, 362, respectively. In some embodiments, the metadata 322, 362 includes configurable properties, flags, and lists that indicate how the event delivery system should perform sub-event delivery to actively involved event recognizers. In some embodiments, metadata 322, 362 may include configurable properties, flags, and lists that indicate how event recognizers may interact with one another. In some embodiments, metadata 322, 362 may include configurable properties, flags, and lists that indicate whether sub-events are delivered to varying levels in the view or programmatic hierarchy. In some embodiments, the combination of event recognizer metadata 322, 362 and view or level metadata (341, 381, respectively) are both be used to configure the event delivery system to: a) perform sub-event delivery to actively involved event recognizers, b) indicate how event recognizers may interact with one another, and c) indicate whether and when sub-events are delivered to various levels in the view or programmatic hierarchy.

It is noted that, in some embodiments, a respective event recognizer sends an event recognition action 333, 373 to its respective target 335, 375, as specified by fields of the event recognizer's structure 320, 360. Sending an action to a target is distinct from sending (and deferred sending) sub-events to a respective hit view or level.

The metadata properties stored in a respective event recognizer structure 320, 360 of a corresponding event recognizer includes one or more of:

-   -   An exclusivity flag 324, 364, which, when set for an event         recognizer, indicates that upon recognition of an event by the         event recognizer, the event delivery system should stop         delivering sub-events to any other event recognizers of the         actively involved views or programmatic levels (with the         exception of any other event recognizers listed in an exception         list 326, 366). When receipt of a sub-event causes a particular         event recognizer to enter the exclusive state, as indicated by         its corresponding exclusivity flag 324 or 364, then subsequent         sub-events are delivered only to the event recognizer in the         exclusive state (as well as any other event recognizers listed         in an exception list 326, 366).     -   Some event recognizer structures 320, 360, may include an         exclusivity exception list 326, 366. When included in the event         recognizer structure 320, 360 for a respective event recognizer,         this list 326, 366 indicates the set of event recognizers, if         any, that are to continue receiving sub-events even after the         respective event recognizer has entered the exclusive state. For         example, if the event recognizer for a single tap event enters         the exclusive state, and the currently involved views include an         event recognizer for a double tap event, then the list 320, 360         would list the double tap event recognizer so that a double tap         event can be recognized even after a single tap event has been         detected. Accordingly, the exclusivity exception list 326, 366         permits event recognizers to recognize different events that         share common sequences of sub-events, e.g., a single tap event         recognition does not preclude subsequent recognition of a double         or triple tap event by other event recognizers.     -   Some event recognizer structures 320, 360, may include a         wait-for list 327, 367. When included in the event recognizer         structure 320, 360 for a respective event recognizer, this list         327, 367 indicates the set of event recognizers, if any, that         must enter the event impossible or event canceled state before         the respective event recognizer can recognize a respective         event. In effect, the listed event recognizers have higher         priority for recognizing an event than the event recognizer with         the wait-for list 327, 367.     -   A delay touch began flag 328, 368, which, when set for an event         recognizer, causes the event recognizer to delay sending         sub-events (including a touch begin or finger down sub-event,         and subsequent events) to the event recognizer's respective hit         view or level until after it has been determined that the         sequence of sub-events does not correspond to this event         recognizer's event type. This flag can be used to prevent the         hit view or level from ever seeing any of the sub-events in the         case where the gesture is recognized. When the event recognizer         fails to recognize an event, the touch began sub-event (and         sub-sequent touch end sub-event) can be delivered to the hit         view or level. In one example, delivering such sub-events to the         hit view or level causes the user interface to briefly highlight         an object, without invoking the action associated with that         object.     -   A delay touch end flag 330, 370, which, when set for an event         recognizer, causes the event recognizer to delay sending a         sub-event (e.g., a touch end sub-event) to the event         recognizer's respective hit view or level until it has been         determined that the sequence of sub-events does not correspond         to this event recognizer's event type. This can be used to         prevent the hit view or level from acting upon a touch end         sub-event, in case the gesture is later recognized. As long as         the touch end sub-event is not sent, a touch canceled can be         sent to the hit view or level. If an event is recognized, the         corresponding action by an application is preformed, and the         touch end sub-event is delivered to the hit view or level.     -   A touch cancellation flag 332, 372, which, when set for an event         recognizer, causes the event recognizer to send touch or input         cancellation to the event recognizer's respective hit view or         hit level when it has been determined that the sequence of         sub-events does not correspond to this event recognizer's event         type. The touch or input cancellation sent to the hit view or         level indicates that a prior sub-event (e.g., a touch began         sub-event) has been cancelled. The touch or input cancellation         may cause the input source handler's state (see FIG. 4B) to         enter the input sequence cancelled state 460 (discussed below).

In some embodiments, the exception list 326, 366 can also be used by non-exclusive event recognizers. In particular, when a non-exclusive event recognizer recognizes an event, subsequent sub-events are not delivered to the exclusive event recognizers associated with the currently active views, except for those exclusive event recognizers listed in the exception list 326, 366 of the event recognizer that recognized the event.

In some embodiments, event recognizers may be configured to utilize the touch cancellation flag in conjunction with the delay touch end flag to prevent unwanted sub-events from being delivered to the hit view. For example, the definition of a single tap gesture and the first half of a double tap gesture are identical. Once a single tap event recognizer successfully recognizes a single tap, an undesired action could take place. If the delay touch end flag is set, the single tap event recognizer is prevented from sending sub-events to the hit view until a single tap event is recognized. In addition, the wait-for list of the single tap event recognizer may identify the double-tap event recognizer, thereby preventing the single tap event recognizer from recognizing a single tap until the double-tap event recognizer has entered the event impossible state. The use of the wait-for list avoids the execution of actions associated with a single tap when a double tap gesture is performed. Instead, only actions associated with a double tap will be executed, in response to recognition of the double tap event.

Turning in particular to forms of user touches on touch-sensitive surfaces, as noted above, touches and user gestures may include an act that need not be instantaneous, e.g., a touch can include an act of moving or holding a finger against a display for a period of time. A touch data structure, however, defines the state of a touch (or, more generally, the state of any input source) at a particular time. Therefore, the values stored in a touch data structure may change over the course of a single touch, enabling the state of the single touch at different points in time to be conveyed to an application.

Each touch data structure can comprise various fields. In some embodiments, touch data structures may include data corresponding to at least the touch-specific fields 339 in FIG. 3B or input source specific fields 379 in FIG. 3C.

For example, a “first touch for view” field 345 in FIG. 3B (385 for “first touch for level” in FIG. 3C) can indicate whether the touch data structure defines the first touch for the particular view (since the software element implementing the view was instantiated). A “time stamp” field 346, 386 can indicate the particular time to which the touch data structure relates.

Optionally, an “info” field 347, 387 can be used to indicate if a touch is a rudimentary gesture. For example, the “info” field 347, 387 can indicate whether the touch is a swipe and, if so, in which direction the swipe is oriented. A swipe is a quick drag of one or more fingers in a straight direction. API implementations (discussed below) can determine if a touch is a swipe and pass that information to the application through the “info” field 347, 387, thus alleviating the application of some data processing that would have been necessary if the touch were a swipe.

Optionally, a “tap count” field 348 in FIG. 3B (“event count” field 388 in FIG. 3C) can indicate how many taps have been sequentially performed at the position of the initial touch. A tap can be defined as a quick pressing and lifting of a finger against a touch-sensitive panel at a particular position. Multiple sequential taps can occur if the finger is again pressed and released in quick succession at the same position of the panel. An event delivery system 122 can count taps and relay this information to an application through the “tap count” field 348. Multiple taps at the same location are sometimes considered to be a useful and easy to remember command for touch enabled interfaces. Thus, by counting taps, the event delivery system 122 can again alleviate some data processing from the application.

A “phase” field 349, 389 can indicate a particular phase the touch-based gesture is currently in. The phase field 349, 389 can have various values, such as “touch phase began” which can indicate that the touch data structure defines a new touch that has not been referenced by previous touch data structures. A “touch phase moved” value can indicate that the touch being defined has moved from a prior position. A “touch phase stationary” value can indicate that the touch has stayed in the same position. A “touch phase ended” value can indicate that the touch has ended (e.g., the user has lifted his/her finger from the surface of a multi touch display). A “touch phase cancelled” value can indicate that the touch has been cancelled by the device. A cancelled touch can be a touch that is not necessarily ended by a user, but which the device has determined to ignore. For example, the device can determine that the touch is being generated inadvertently (i.e., as a result of placing a portable multi touch enabled device in one's pocket) and ignore the touch for that reason. Each value of the “phase field” 349, 389 can be an integer number.

Thus, each touch data structure can define what is happening with a respective touch (or other input source) at a particular time (e.g., whether the touch is stationary, being moved, etc.) as well as other information associated with the touch (such as position). Accordingly, each touch data structure can define the state of a particular touch at a particular moment in time. One or more touch data structures referencing the same time can be added in a touch event data structure that can define the states of all touches a particular view is receiving at a moment in time (as noted above, some touch data structures may also reference touches that have ended and are no longer being received). Multiple touch event data structures can be sent to the software implementing a view as time passes, in order to provide the software with continuous information describing the touches that are happening in the view.

FIG. 3D is a block diagram illustrating exemplary components for event handling (e.g., event handling components 390) in accordance with some embodiments. In some embodiments, memory 111 (FIG. 1A) includes event recognizer global methods 312 and one or more applications (e.g., 133-1 through 133-3).

In some embodiments, event recognizer global methods 312 include event monitor 311, hit view determination module 314, active event recognizer determination module 316, and event dispatcher module 315. In some embodiments, event recognizer global methods 312 are located within event delivery system 122 (FIG. 1A). In some embodiments, event recognizer global methods 312 are implemented in operating system 118 (FIG. 1A). Alternatively, event recognizer global methods 312 are implemented in a respective application 133-1. In yet other embodiments, event recognizer global methods 312 are implemented as a stand-alone module, or a part of another module stored in memory 111 (e.g., a contact/motion module (not depicted)).

Event monitor 311 receives event information from one or more sensors 116, touch-sensitive display 156, and/or one or more input devices 128. Event information includes information about an event (e.g., a user touch on touch-sensitive display 156, as part of a multi-touch gesture or a motion of device 102) and/or a sub-event (e.g., a movement of a touch across touch-sensitive display 156). For example, event information for a touch event includes one or more of: a location and time stamp of a touch. Similarly, event information for a swipe event includes two or more of: a location, time stamp, direction, and speed of a swipe. Sensors 116, touch-sensitive display 156, and input devices 128 transmit information event and sub-event information to event monitor 311 either directly or through a peripherals interface, which retrieves and stores event information. Sensors 116 include one or more of: proximity sensor, accelerometer(s), gyroscopes, microphone, and video camera. In some embodiments, sensors 116 also include input devices 128 and/or touch-sensitive display 156.

In some embodiments, event monitor 311 sends requests to sensors 116 and/or the peripherals interface at predetermined intervals. In response, sensors 116 and/or the peripherals interface transmit event information. In other embodiments, sensors 116 and the peripheral interface transmit event information only when there is a significant event (e.g., receiving an input beyond a predetermined noise threshold and/or for more than a predetermined duration).

Event monitor 311 receives event information and relays the event information to event dispatcher module 315. In some embodiments, event monitor 311 determines one or more respective applications (e.g., 133-1) to which to deliver the event information. In some embodiments, event monitor 311 also determines one or more respective application views 317 of the one or more respective applications to which to deliver the event information.

In some embodiments, event recognizer global methods 312 also include a hit view determination module 314 and/or an active event recognizer determination module 316.

Hit view determination module 314, if present, provides software procedures for determining where an event or a sub-event has taken place within one or more views, when touch-sensitive display 156 displays more than one view. Views are made up of controls and other elements that a user can see on the display.

Another aspect of the user interface associated with a respective application (e.g., 133-1) is a set of views 317, sometimes herein called application views or user interface windows, in which information is displayed and touch-based gestures occur. The application views (of a respective application) in which a touch is detected may correspond to a particular view within a view hierarchy of the application. For example, the lowest level view in which a touch is detected may be called the hit view, and the set of events that are recognized as proper inputs may be determined based, at least in part, on the hit view of the initial touch that begins a touch-based gesture.

Hit view determination module 314 receives information related to events and/or sub-events. When an application has multiple views organized in a hierarchy, hit view determination module 314 identifies a hit view as the lowest view in the hierarchy which should handle the event or sub-event. In most circumstances, the hit view is the lowest level view in which an initiating event or sub-event occurs (i.e., the first event or sub-event in the sequence of events and/or sub-events that form a gesture). Once the hit view is identified by the hit view determination module, the hit view typically receives all events and/or sub-events related to the same touch or input source for which it was identified as the hit view. However, the hit view is not always a sole view that receives all events and/or sub-events related to the same touch or input source for which it was identified as the hit view. Stated differently, in some embodiments, another application (e.g., 133-2) or another view of the same application also receives at least a subset of the events and/or sub-events related to the same touch or input source regardless of whether a hit view has been determined for the touch or input source.

Active event recognizer determination module 316 determines which view or views within a view hierarchy should receive a particular sequence of events and/or sub-events. In some application contexts, active event recognizer determination module 316 determines that only the hit view should receive a particular sequence of events and/or sub-events. In other application contexts, active event recognizer determination module 316 determines that all views that include the physical location of an event or sub-event are actively involved views, and therefore determines that all actively involved views should receive a particular sequence of events and/or sub-events. In other application contexts, even if touch events and/or sub-events are entirely confined to the area associated with one particular view, views higher in the hierarchy still remain as actively involved views and thus the views higher in the hierarchy should receive a particular sequence of events and/or sub-events. Additionally, or alternatively, active event recognizer determination module 316 determines which application(s) in a programmatic hierarchy should receive a particular sequence of events and/or sub-events. Thus, in some embodiments, active event recognizer determination module 316 determines that only a respective application in the programmatic hierarchy should receive a particular sequence of events and/or sub-events. In some embodiments, active event recognizer determination module 316 determines that a plurality of applications in the programmatic hierarchy should receive a particular sequence of events and/or sub-events.

Event dispatcher module 315 dispatches the event information to an event recognizer (also called herein “gesture recognizer”) (e.g., event recognizer 325-1). In embodiments including active event recognizer determination module 316, event dispatcher module 315 delivers the event information to an event recognizer determined by active event recognizer determination module 316. In some embodiments, event dispatcher module 315 stores in an event queue the event information, which is retrieved by a respective event recognizer 325 (or event receiver 3031 in a respective event recognizer 325).

In some embodiments, a respective application (e.g., 133-1) includes application internal state 321, which indicates the current application view(s) displayed on touch-sensitive display 156 when the application is active or executing. In some embodiments, device/global internal state 134 (FIG. 1C) is used by event recognizer global methods 312 to determine which application(s) is(are) currently active, and application internal state 321 is used by event recognizer global methods 312 to determine application views 317 to which to deliver event information.

In some embodiments, application internal state 321 includes additional information, such as one or more of: resume information to be used when application 133-1 resumes execution, user interface state information that indicates information being displayed or that is ready for display by application 133-1, a state queue for enabling the user to go back to a prior state or view of application 133-1, and a redo/undo queue of previous actions taken by the user. In some embodiments, application internal state 321 further includes contextual information/text and metadata 323.

In some embodiments, application 133-1 includes one or more application views 317, each of which has corresponding instructions for handling touch events that occur within a respective view of the application's user interface (e.g., a corresponding event handler 319). At least one application view 317 of the application 133-1 includes one or more event recognizers 325. Typically, a respective application view 317 includes a plurality of event recognizers 325. In other embodiments, one or more of event recognizers 325 are part of a separate module, such as a user interface kit (not shown) or a higher level object from which application 133-1 inherits methods and other properties. In some embodiments, a respective application view 317 also includes one or more of: data updater, object updater, GUI updater, and/or event data received.

A respective application (e.g., 133-1) also includes one or more event handlers 319. Typically, a respective application (e.g., 133-1) includes a plurality of event handlers 319.

A respective event recognizer 325-1 receives event information from event dispatcher module 315 (directly or indirectly through application 133-1), and identifies an event from the event information. Event recognizer 325-1 includes event receiver 3031 and event comparator 3033.

The event information includes information about an event (e.g., a touch) or a sub-event (e.g., a touch movement). Depending on the event or sub-event, the event information also includes additional information, such as location of the event or sub-event. When the event or sub-event concerns motion of a touch, the event information may also include speed and direction of the sub-event. In some embodiments, events include rotation of the device from one orientation to another (e.g., from a portrait orientation to a landscape orientation, or vice versa), and the event information includes corresponding information about the current orientation (also called device attitude) of the device.

Event comparator 3033 compares the event information to one or more predefined gesture definitions (also called herein “event definitions”) and, based on the comparison, determines an event or sub-event, or determines or updates the state of an event or sub-event. In some embodiments, event comparator 3033 includes one or more gesture definitions 3035 (as described above, also called herein “event definitions”). Gesture definitions 3035 contain definitions of gestures (e.g., predefined sequences of events and/or sub-events), for example, gesture 1 (3037-1), gesture 2 (3037-2), and others. In some embodiments, sub-events in gesture definitions 3035 include, for example, touch begin, touch end, touch movement, touch cancellation, and multiple touching. In one example, the definition for gesture 1 (3037-1) is a double tap on a displayed object. The double tap, for example, comprises a first touch (touch begin) on the displayed object for a predetermined phase of the gesture, a first lift-off (touch end) for a next predetermined phase of the gesture, a second touch (touch begin) on the displayed object for a subsequent predetermined phase of the gesture, and a second lift-off (touch end) for a final predetermined phase of the gesture. In another example, the definition for gesture 2 (3037-2) includes a dragging on a displayed object. The dragging, for example, comprises a touch (or contact) on the displayed object, a movement of the touch across touch-sensitive display 156, and lift-off of the touch (touch end).

In some embodiments, event recognizer 325-1 also includes information for event delivery 3039. Information for event delivery 3039 includes references to corresponding event handlers 319. Optionally, information for event delivery 3039 includes action-target pair(s). In some embodiments, in response to recognizing a gesture (or a part of a gesture), event information (e.g., action message(s)) is sent to one or more targets identified by the action-target pair(s). In other embodiments, in response to recognizing a gesture (or a part of a gesture), the action-target pair(s) are activated.

In some embodiments, gesture definitions 3035 include a definition of a gesture for a respective user-interface object. In some embodiments, event comparator 3033 performs a hit test to determine which user-interface object is associated with a sub-event. For example, in an application view in which three user-interface objects are displayed on touch-sensitive display 156, when a touch is detected on touch-sensitive display 156, event comparator 3033 performs a hit test to determine which of the three user-interface objects, if any, is associated with the touch (event). If each displayed object is associated with a respective event handler 319, event comparator 3033 uses the result of the hit test to determine which event handler 319 should be activated. For example, event comparator 3033 selects an event handler 319 associated with the event and the object triggering the hit test.

In some embodiments, a respective gesture definition 3037 for a respective gesture also includes delayed actions that delay delivery of the event information until after it has been determined whether the sequence of events and/or sub-events does or does not correspond to the event recognizer's event type.

When a respective event recognizer 325-1 determines that the series of events and/or sub-events do not match any of the events in gesture definitions 3035, the respective event recognizer 325-1 enters an event failed state, after which the respective event recognizer 325-1 disregards subsequent events and/or sub-events of the touch-based gesture. In this situation, other event recognizers, if any, that remain active for the hit view continue to track and process events and/or sub-events of an ongoing touch-based gesture.

In some embodiments, when no event recognizer for the hit view remains, the event information is sent to one or more event recognizers in a higher view in the view hierarchy. Alternatively, when no event recognizer for the hit view remains, the event information is disregarded. In some embodiments, when no event recognizer for views in the view hierarchy remains, the event information is sent to one or more event recognizers in a higher programmatic level in the programmatic hierarchy. Alternatively, when no event recognizer for views in the view hierarchy remains, the event information is disregarded.

In some embodiments, a respective event recognizer 325-1 includes event recognizer state 334. Event recognizer state 334 includes a state of the respective event recognizer 325-1. Examples of event recognizer states are described in more detail below with reference to FIGS. 4A-4B and 5A-5C.

In some embodiments, event recognizer state 334 includes recognizer metadata and properties 3043. In some embodiments, recognizer metadata and properties 3043 include one or more of the following: A) configurable properties, flags, and/or lists that indicate how the event delivery system should perform event and/or sub-event delivery to actively involved event recognizers; B) configurable properties, flags, and/or lists that indicate how event recognizers interact with one another; C) configurable properties, flags, and/or lists that indicate how event recognizers receive event information; D) configurable properties, flags, and/or lists that indicate how event recognizers may recognize a gesture; E) configurable properties, flags, and/or lists that indicate whether events and/or sub-events are delivered to varying levels in the view hierarchy; and F) references to corresponding event handlers 319.

In some embodiments, event recognizer state 334 includes event/touch metadata 3045. Event/touch metadata 3045 includes event/touch information about a respective event/touch that has been detected and corresponds to a respective gesture definition 3037 of gesture definitions 3035. The event/touch information includes one or more of: a location, time stamp, speed, direction, distance, scale (or change in scale), and angle (or change in angle) of the respective event/touch.

In some embodiments, a respective event recognizer 325 activates event handler 319 associated with the respective event recognizer 325 when one or more particular events and/or sub-events of a gesture are recognized. In some embodiments, respective event recognizer 325 delivers event information associated with the event to event handler 319.

Event handler 319, when activated, performs one or more of: creating and/or updating data, creating and updating objects, and preparing display information and sending it for display on display 126 or touch-sensitive display 156.

In some embodiments, a respective application view 317-2 includes view metadata 341. As described above with respect to FIG. 3B, view metadata 341 includes data regarding a view. Optionally, view metadata 341 includes one or more of: stop property 342, skip property 343, NoHit skip property 344, and other view metadata 329.

In some embodiments, a first actively involved view within the view hierarchy may be configured to prevent delivery of a respective sub-event to event recognizers associated with that first actively involved view. This behavior can implement the skip property 343. When the skip property is set for an application view, delivery of the respective sub-event is still performed for event recognizers associated with other actively involved views in the view hierarchy.

Alternately, a first actively involved view within the view hierarchy may be configured to prevent delivery of a respective sub-event to event recognizers associated with that first actively involved view unless the first actively involved view is the hit view. This behavior can implement the conditional NoHit skip property 344.

In some embodiments, a second actively involved view within the view hierarchy is configured to prevent delivery of the respective sub-event to event recognizers associated with the second actively involved view and to event recognizers associated with ancestors of the second actively involved view. This behavior can implement the stop property 342.

FIG. 3E is a block diagram illustrating exemplary classes and instances of gesture recognizers (e.g., event handling components 390) in accordance with some embodiments.

A software application (e.g., application 133-1) has one or more event recognizers 3040. In some embodiments, a respective event recognizer (e.g., 3040-2) is an event recognizer class. The respective event recognizer (e.g., 3040-2) includes event recognizer specific code 338 (e.g., a set of instructions defining the operation of event recognizers) and state machine 340.

In some embodiments, application state 321 of a software application (e.g., application 133-1) includes instances of event recognizers. Each instance of an event recognizer is an object having a state (e.g., event recognizer state 334). “Execution” of a respective event recognizer instance is implemented by executing corresponding event recognizer specific code (e.g., 338) and updating or maintaining the state 334 of the event recognizer instance 3047. The state 334 of event recognizer instance 3047 includes the state 3038 of the event recognizer instance's state machine 340.

In some embodiments, application state 321 includes a plurality of event recognizer instances 3047. A respective event recognizer instance 3047 typically corresponds to an event recognizer that has been bound (also called “attached”) to a view of the application. In some embodiments, one or more event recognizer instances 3047 are bound to a respective application in a programmatic hierarchy without reference to any particular view of the respective application. In some embodiments, application state 321 includes a plurality of instances (e.g., 3047-1 to 3047-L) of a respective event recognizer (e.g., 3040-2). In some embodiments, application state 321 includes instances 3047 of a plurality of event recognizers (e.g., 3040-1 to 3040-R).

In some embodiments, a respective instance 3047-2 of a gesture recognizer 3040 includes event recognizer state 334. As discussed above, in some embodiments, event recognizer state 334 includes recognizer metadata and properties 3043 and event/touch metadata 3045. In some embodiments, event recognizer state 334 also includes view hierarchy reference(s) 336, indicating to which view the respective instance 3047-2 of the gesture recognizer 3040-2 is attached.

In some embodiments, recognizer metadata and properties 3043 include the following, or a subset or superset thereof:

-   -   exclusivity flag 324;     -   exclusivity exception list 326;     -   wait-for list 327;     -   delay touch began flag 328;     -   delay touch end flag 330; and     -   touch cancellation flag 332.

In some embodiments, one or more event recognizers may be adapted to delay delivering one or more sub-events of the sequence of sub-events until after the event recognizer recognizes the event. This behavior reflects a delayed event. For example, consider a single tap gesture in a view for which multiple tap gestures are possible. In that case, a tap event becomes a “tap+delay” recognizer. In essence, when an event recognizer implements this behavior, the event recognizer will delay event recognition until it is certain that the sequence of sub-events does in fact correspond to its event definition. This behavior may be appropriate when a recipient view is incapable of appropriately responding to cancelled events. In some embodiments, an event recognizer will delay updating its event recognition status to its respective actively involved view until the event recognizer is certain that the sequence of sub-events does not correspond to its event definition. Delay touch began flag 328, delay touch end flag 330, and touch cancellation flag 332 are provided to tailor sub-event delivery techniques, as well as event recognizer and view status information updates to specific needs.

In some embodiments, recognizer metadata and properties 3043 include the following, or a subset or superset thereof:

-   -   state machine state/phase 3038, which indicates the state of a         state machine (e.g., 340) for the respective event recognizer         instance (e.g., 3047-2); state machine state/phase 3038 can have         various state values, such as “event possible”, “event         recognized”, “event failed”, and others, as described below;         alternatively or additionally, state machine state/phase 3038         can have various phase values, such as “touch phase began” which         can indicate that the touch data structure defines a new touch         that has not been referenced by previous touch data structures;         a “touch phase moved” value can indicate that the touch being         defined has moved from a prior position; a “touch phase         stationary” value can indicate that the touch has stayed in the         same position; a “touch phase ended” value can indicate that the         touch has ended (e.g., the user has lifted his/her finger from         the surface of a multi touch display); a “touch phase cancelled”         value can indicate that the touch has been cancelled by the         device; a cancelled touch can be a touch that is not necessarily         ended by a user, but which the device has determined to ignore;         for example, the device can determine that the touch is being         generated inadvertently (i.e., as a result of placing a portable         multi touch enabled device in one's pocket) and ignore the touch         for that reason; each value of state machine state/phase 3038         can be an integer number (called herein “gesture recognizer         state value”);     -   action-target pair(s) 3051, where each pair identifies a target         to which the respective event recognizer instance sends the         identified action message in response to recognizing an event or         touch as a gesture or a part of a gesture;     -   delegate 3053, which is a reference to a corresponding delegate         when a delegate is assigned to the respective event recognizer         instance; when a delegate is not assigned to the respective         event recognizer instance, delegate 346 contains a null value;         and     -   enabled property 3055, indicating whether the respective event         recognizer instance is enabled; in some embodiments, when the         respective event recognizer instance is not enabled (e.g.,         disabled), the respective event recognizer instance does not         process events or touches.

In some embodiments, exception list 326 can also be used by non-exclusive event recognizers. In particular, when a non-exclusive event recognizer recognizes an event or sub-event, subsequent events and/or sub-events are not delivered to the exclusive event recognizers associated with the currently active views, except for those exclusive event recognizers listed in exception list 326 of the event recognizer that recognized the event or sub-event.

In some embodiments, event recognizers may be configured to utilize the touch cancellation flag 332 in conjunction with the delay touch end flag 330 to prevent unwanted events and/or sub-events from being delivered to the hit view. For example, the definition of a single tap gesture and the first half of a double tap gesture are identical. Once a single tap event recognizer successfully recognizes a single tap, an undesired action could take place. If the delay touch end flag is set, the single tap event recognizer is prevented from sending sub-events to the hit view until a single tap event is recognized. In addition, the wait-for list of the single tap event recognizer may identify the double-tap event recognizer, thereby preventing the single tap event recognizer from recognizing a single tap until the double-tap event recognizer has entered the event impossible state. The use of the wait-for list avoids the execution of actions associated with a single tap when a double tap gesture is performed. Instead, only actions associated with a double tap will be executed, in response to recognition of the double tap event.

Turning in particular to forms of user touches on touch-sensitive surfaces, as noted above, touches and user gestures may include an act that need not be instantaneous, e.g., a touch can include an act of moving or holding a finger against a display for a period of time. A touch data structure, however, defines the state of a touch (or, more generally, the state of any input source) at a particular time. Therefore, the values stored in a touch data structure may change over the course of a single touch, enabling the state of the single touch at different points in time to be conveyed to an application.

Each touch data structure can comprise various entries. In some embodiments, touch data structures may include data corresponding to at least the touch-specific entries in event/touch metadata 3045 such as the following, or a subset or superset thereof:

-   -   “first touch for view” entry 345;     -   “per touch info” entry 3051, including “time stamp” information,         which indicates the particular time to which the touch data         structure relates (e.g., the time of touch); optionally, “per         touch info” entry 3051 includes other information, such as a         location of a corresponding touch; and     -   optional “tap count” entry 348.

Thus, each touch data structure can define what is happening with a respective touch (or other input source) at a particular time (e.g., whether the touch is stationary, being moved, etc.) as well as other information associated with the touch (such as position). Accordingly, each touch data structure can define the state of a particular touch at a particular moment in time. One or more touch data structures referencing the same time can be added in a touch event data structure that can define the states of all touches a particular view is receiving at a moment in time (as noted above, some touch data structures may also reference touches that have ended and are no longer being received). Multiple touch event data structures can be sent to the software implementing a view as time passes, in order to provide the software with continuous information describing the touches that are happening in the view.

The ability to handle complex touch-based gestures, optionally including multi-touch gestures, can add complexity to the various software applications. In some cases, such additional complexity can be necessary to implement advanced and desirable interface features. For example, a game may require the ability to handle multiple simultaneous touches that occur in different views, as games often require the pressing of multiple buttons at the same time, or combining accelerometer data with touches on a touch-sensitive surface. However, some simpler applications and/or views need not require advanced interface features. For example, a simple soft button (i.e., a button that is displayed on a touch-sensitive display) may operate satisfactorily with single touches, rather than multi-touch functionality. In these cases, the underlying OS may send unnecessary or excessive touch data (e.g., multi-touch data) to a software component associated with a view that is intended to be operable by single touches only (e.g., a single touch or tap on a soft button). Because the software component may need to process this data, it may need to feature all the complexity of a software application that handles multiple touches, even though it is associated with a view for which only single touches are relevant. This can increase the cost of development of software for the device, because software components that have been traditionally easy to program in a mouse interface environment (i.e., various buttons, etc.) may be much more complex in a multi-touch environment.

In order to reduce the complexity in recognizing complex touch-based gestures, delegates can be used to control the behavior of event recognizers in accordance with some embodiments. As described below, delegates can determine, for example, whether a corresponding event recognizer (or gesture recognizer) can receive the event (e.g., touch) information; whether the corresponding event recognizer (or gesture recognizer) can transition from an initial state (e.g., event possible state) of state machine to another state; and/or whether the corresponding event recognizer (or gesture recognizer) can simultaneously recognize the event (e.g., touch) as a corresponding gesture without blocking other event recognizer(s) (or gesture recognizer(s)) from recognizing the event or getting blocked by other event recognizer(s) (or gesture recognizer(s)) recognizing the event.

It shall be understood, however, that the foregoing discussion regarding the complexity of evaluating and processing user touches on touch-sensitive surfaces also applies to all forms of user inputs to operate electronic device 102 with input devices 128, not all of which are initiated on touch screens, e.g., coordinating mouse movement and mouse button presses with or without single or multiple keyboard presses or holds, device rotations or other movements, user movements such as taps, drags, scrolls, etc., on touch-pads, pen stylus inputs, oral instructions, detected eye movements, biometric inputs, detected physiological change in a user, and/or any combination thereof, which may be utilized as inputs corresponding to events and/or sub-events which define an event to be recognized.

Turning to the flow of event information, FIG. 3F is a block diagram illustrating the flow of event information in accordance with some embodiments. Event dispatcher module 315 (e.g., in operating system 118 or application software 124) receives event information, and sends the event information to one or more applications (e.g., 133-1 and 133-2). In some embodiments, application 133-1 includes a plurality of views (e.g., 508, 510, and 512 corresponding to views 317, FIG. 3D) in view hierarchy 506 and a plurality of gesture recognizers (516-1 through 516-3) in the plurality of views. Application 133-1 also includes one or more gesture handlers 550, which correspond to the target values in target-action pairs (e.g., 552-1 and 552-2). In some embodiments, event dispatcher module 315 receives hit view information from hit view determination module 314 and sends event information to the hit view (e.g., 512) or event recognizer(s) attached to the hit view (e.g., 516-1 and 516-2). Additionally or alternatively, event dispatcher module 315 receives hit level information from hit level determination module 352 and sends event information to applications in the hit level (e.g., 133-1 and 133-2) or one or more event recognizers (e.g., 516-4) in the hit level applications. In some embodiments, one of the applications receiving the event information is a default application (e.g., 133-2 may be a default application). In some embodiments, only a subset of gesture recognizers in each receiving application is allowed to (or configured to) receive the event information. For example, gesture recognizer 516-3 in application 133-1 does not receive the event information. The gesture recognizers that receive the event information are called herein receiving gesture recognizers. In FIG. 3F, receiving gesture recognizers 516-1, 516-2, and 516-4 receive the event information, and compare the received event information with a respective gesture definition 3037 (FIG. 3D) in the receiving gesture recognizers. In FIG. 3F, gesture recognizers 516-1 and 516-4 have respective gesture definitions that match the received event information, and send respective action messages (e.g., 518-1 and 518-2) to corresponding gesture handlers (e.g., 552-1 and 552-3).

FIG. 4A depicts an event recognizer state machine 400 containing four states. By managing state transitions in event recognizer state machine 400 based on received sub-events, an event recognizer effectively expresses an event definition. For example, a tap gesture may be effectively defined by a sequence of two, or optionally, three sub-events. First, a touch should be detected, and this will be sub-event 1. For example, the touch sub-event may be a user's finger touching a touch-sensitive surface in a view that includes the event recognizer having state machine 400. Second, an optional measured delay where the touch does not substantially move in any given direction (e.g., any movement of the touch position is less than a predefined threshold, which may be measured as a distance (e.g., 5 mm) or as a number of pixels (e.g., 5 pixels) on the display), and the delay is sufficiently short, would serve as sub-event 2. Finally, termination of the touch (e.g., liftoff of the user's finger from the touch-sensitive surface) will serve as sub-event 3. By coding the event recognizer state machine 400 to transition between states based upon receiving these sub-events, the event recognizer state machine 400 effectively expresses a tap gesture event definition. However, it should be noted that the states depicted in FIG. 4A are exemplary states, and an event recognizer state machine 400 may contain more or fewer states and/or each state in the event recognizer state machine 400 may correspond to one of the depicted states or any other states.

In some embodiments, regardless of event type, the event recognizer state machine 400 begins in an event recognition begins state 405, and may progress to any of the remaining states depending on what sub-event is received. To facilitate discussion of the event recognizer state machine 400, the direct paths from the event recognition begins state 405 to the event recognized state 415, the event possible state 410, and event impossible state 420 will be discussed, followed by a description of the paths leading from the event possible state 410.

Starting from event recognition begins state 405, if a sub-event is received that, by itself comprises the event definition for an event, the event recognizer state machine 400 will transition to event recognized state 415.

Starting from state event recognition begins 405, if a sub-event is received that is not the first sub-event in an event definition, the event recognizer state machine 400 will transition to event impossible state 420.

Starting from event recognition begins state 405, if a sub-event is received that is the first and not final sub-event in a given event definition, the event recognizer state machine 400 will transition to event possible state 410. If the next sub-event received is a second sub-event, but not the final sub-event in the given event definition, the event recognizer state machine 400 will remain in state event possible 410. The event recognizer state machine 400 can remain in state event possible 410 for as long as the sequence of received sub-events continues to be part of the event definition. If, at any time the event recognizer state machine 400 is in event possible state 410, and the event recognizer state machine 400 receives a sub-event that is not part of the event definition, it will transition to state event impossible 420, thereby determining that the current event (if any) is not the type of event that corresponds to this event recognizer (i.e., the event recognizer corresponding to state 400). If, on the other hand, the event recognizer state machine 400 is in the event possible state 410, and the event recognizer state machine 400 receives the last sub-event in an event definition, it will transition to the event recognized state 415, thereby completing a successful event recognition.

FIG. 4B depicts an embodiment of an input source handling process 440, having a finite state machine representing how views receive information about a respective input. It is noted that when there are multiple touches on the touch-sensitive surface of a device, each of the touches is a separate input source having its own finite state machine. In this embodiment, input source handling process 440 includes four states: input sequence begin 445, input sequence continues 450, input sequence ended 455, and input sequence cancelled 460. Input source handling process 440 may be used by a respective event recognizer, for example, when input is to be delivered to an application, but only after the completion of an input sequence is detected. Input source handling process 440 can be used with an application that is incapable of canceling or undoing changes made in response to an input sequence delivered to the application. It should be noted that the states depicted in FIG. 4B are exemplary states, and input source handling process 440 may contain more or fewer states and/or each state in input source handling process 440 may correspond to one of the depicted states or any other states.

Starting from input sequence begin 445, if an input is received that, by itself completes an input sequence, input source handling process 440 will transition to input sequence ended 455.

Starting from input sequence begin 445, if an input is received that indicates the input sequence terminated, input source handling process 440 will transition to input sequence cancelled 460.

Starting from input sequence begin 445, if an input is received that is the first and not final input in a input sequence, input source handling process 440 will transition to state input sequence continues 450. If the next input received is the second input in an input sequence, the input handling process 440 will remain in state input sequence continues 450. Input source handling process 440 can remain in state input sequence continues 450 for as long as the sequence of sub-events being delivered continue to be part of a given input sequence. If, at any time input source handling process 440 is in state input sequence continues 450, and input source handling process 440 receives an input that is not part of the input sequence, it will transition to state input sequence cancelled 460. If, on the other hand, input source handling process 440 is in input sequence continues 450, and the input handling process 440 receives the last input in a given input definition, it will transition to the input sequence ended 455, thereby successfully receiving a group of sub-events.

In some embodiments, input source handling process 440 may be implemented for particular views or programmatic levels. In that case, certain sequences of sub-events may result in transitioning to state input cancelled 460.

As an example, consider FIG. 4C, which supposes an actively involved view, represented only by actively involved view input source handler 480 (hereafter “view 480”). View 480 includes a vertical swipe event recognizer, represented only by vertical swipe event recognizer 468 (hereafter “recognizer 468”) as one of its event recognizers. In this case, the recognizer 468 may require as part of its definition detecting: 1) a finger down 465-1; 2) an optional short delay 465-2; 3), vertical swiping of at least N pixels 465-3; and 4) a finger liftoff 465-4.

For this example, the recognizer 468 also has its delay touch began flag 328 and touch cancellation flag 332 set. Now consider delivery of the following sequence of sub-events to recognizer 468, as well as the view 480:

-   -   sub-event sequence 465-1: detect finger down, which corresponds         to recognizer 468's event definition     -   sub-event sequence 465-2: measure delay, which corresponds to         recognizer 468's event definition     -   sub-event sequence 465-3: finger performs a vertical swiping         movement compatible with vertical scrolling, but is less than N         pixels, and therefore does not correspond to recognizer 468's         event definition     -   sub-event sequence 465-4: detect finger liftoff, which         corresponds to recognizer 468's event definition

Here, recognizer 468 would successfully recognize sub-events 1 and 2 as part of its event definition, and accordingly, would be in state event possible 472 immediately prior to the delivery of sub-event 3. Since recognizer 468 has its delay touch began flag 328 set, the initial touch sub-event is not sent to the hit view. Correspondingly, the view 480's input source handling process 440 would still be in state input sequence begin immediately prior to the delivery of sub-event 3.

Once delivery of sub-event 3 to recognizer 468 is complete, recognizer 468's state transitions to event impossible 476, and importantly, the recognizer 468 has now determined that the sequence of sub-events does not correspond to its specific vertical swipe gesture event type (i.e., it has decided the event is not a vertical swipe. In other words, recognition 474 as a vertical swipe does not occur in this example.). The input source handling system 440 for view input source handler 480 will also update its state. In some embodiments, the state of the view input source handler 480 would proceed from the input sequence begins state 482 to the input sequence continues state 484 when the event recognizer sends status information indicating that it has begun recognizing an event. The view input source handler 480 proceeds to the input sequence cancelled state 488 when the touch or input ends without an event being recognized because the touch cancellation flag 322 of the event recognizer has been set. Alternately, if the touch cancellation flag 322 of the event recognizer had not been set, the view input source handler 480 proceeds to the input sequence ended state 486 when the touch of input ends.

Since event recognizer 468's touch cancellation flag 332 is set, when the event recognizer 468 transitions to the event impossible state 476, the recognizer will send a touch cancellation sub-event or message to the hit view corresponding to the event recognizer. As a result, the view input source handler 480 will transition to the state input sequence cancelled 488.

In some embodiments, delivery of sub-event 465-4 is not germane to any event recognition decisions made by recognizer 468, though view input source handler 480's other event recognizers, if any, may continue to analyze the sequence of sub-events.

The following table presents in summarized tabular format the processing of this exemplary sub-event sequence 465 as related to the state of event recognizer 468 described above, along with the state of view input source handler 480. In this example, the state of the view input source handler 480 proceeds from input sequence begin 445 to input sequence cancelled 488 because recognizer 468's touch cancellation flag 332 was set:

Sub-Event Sequence 465 State: Recognizer 468 State: View 480 before delivery starts Event Recognition Begins 470 detect finger down Event Possible 472 Input Sequence 465-1 Begins 482 measure delay 465-2 Event Possible 472 Input Sequence Continues 484 detect finger vertical Event Impossible Input Sequence swipe 465-3 476 Continues 484 detect finger liftoff Event Impossible Input Sequence 465-4 476 Cancelled 488

Turning to FIG. 5A, attention is directed to an example of a sub-event sequence 520, which is being received by a view that includes a plurality of event recognizers. For this example, two event recognizers are depicted in FIG. 5A, scrolling event recognizer 580 and tap event recognizer 590. For purposes of illustration, the view search results panel 304 in FIG. 3A will be related to the reception of the sub-event sequence 520, and the state transitions in scrolling event recognizer 580 and tap event recognizer 590. Note that in this example, the sequence of sub-events 520 defines a tap finger gesture on a touch-sensitive display or trackpad, but the same event recognition technique could be applied in a myriad of contexts, e.g., detecting a mouse button press, and/or in embodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to view search results panel 304, event recognizers 580 and 590 are in the event recognition begins states 582 and 592, respectively. Following touch 301, which is delivered as sub-event detect finger down 521-1 to actively involved event recognizers for view search results panel 304 as touch sub-event 301-2 (as well as to actively involved event recognizers for map view 305 as touch sub-event 301-3), scrolling event recognizer 580 transitions to state event possible 584, and similarly, tap event recognizer 590 transitions to state event possible 594. This is because the event definition of a tap and a scroll both begin with a touch such as detecting a finger down on a touch-sensitive surface.

Some definitions of tap and scroll gestures may optionally include a delay between an initial touch and any next step in the event definition. In all examples discussed here, the exemplar event definitions for both tap and scroll gestures recognize a delay sub-event following the first touch sub-event (detect finger down).

Accordingly, as sub-event measure delay 521-2 is delivered to event recognizers 580 and 590, both remain in the event possible states 584 and 594, respectively.

Finally, sub-event detect finger liftoff 521-3 is delivered to event recognizers 580 and 590. In this case, the state transitions for event recognizers 580 and 590 are different, because the event definitions for tap and scroll are different. In the case of scrolling event recognizer 580, the next sub-event to remain in state event possible would be to detect movement. Since the sub-event delivered is detect finger liftoff 521-3, however, the scrolling event recognizer 580 transitions to state event impossible 588. A tap event definition concludes with a finger liftoff sub-event though. Accordingly, tap event recognizer 590 transitions to state event recognized 596 after sub-event detect finger liftoff 521-3 is delivered.

Note that in some embodiments, as discussed above with respect to FIGS. 4B and 4C, the input source handling process 440 discussed in FIG. 4B may be used for various purposes at the view level. The following table presents in summarized tabular format the delivery of sub-event sequence 520 as related to event recognizers 580, 590, and input source handling process 440:

Sub-Event State: Scrolling State: Tap State: Input Sequence Event Recognizer Event Recognizer Source Handling 520 580 590 Process 440 before delivery Event Recogni- Event Recogni- starts tion Begins 582 tion Begins 592 Detect Finger Event Event Input Sequence Down 521-1 Possible 584 Possible 594 Begin 445 Measure Event Event Input Sequence Delay 521-2 Possible 584 Possible 594 Continues 450 Detect Finger Event impossible Event Recognized Input Sequence Liftoff 521-3 588 596 Ended 455

Turning to FIG. 5B, attention is directed to another example of a sub-event sequence 530, which is being received by a view that includes a plurality of event recognizers. For this example, two event recognizers are depicted in FIG. 5B, scrolling event recognizer 580 and tap event recognizer 590. For purposes of illustration, the view search results panel 304 in FIG. 3A will be related to the reception of the sub-event sequence 530, and the state transitions in scrolling event recognizer 580 and tap event recognizer 590. Note that in this example, the sequence of sub-events 530 defines a scroll finger gesture on a touch-sensitive display, but the same event recognition technique could be applied in myriad contexts, e.g., detecting a mouse button press, mouse movement, and mouse button release, and/or in embodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to actively involved event recognizers for view search results panel 304, event recognizers 580 and 590 are in the event recognition begins states 582 and 592, respectively. Following delivery of sub-events corresponding to touch 301 (as discussed above), scrolling event recognizer 580 transitions to state event possible 584, and similarly, tap event recognizer 590 transitions to state event possible 594.

As sub-event measure delay 531-2 is delivered to event recognizers 580 and 590, both transition to the event possible states 584 and 594, respectively.

Next, sub-event detect finger movement 531-3 is delivered to event recognizers 580 and 590. In this case, the state transitions for event recognizers 580 and 590 are different because the event definitions for tap and scroll are different. In the case of scrolling event recognizer 580, the next sub-event to remain in state event possible is to detect movement, so the scrolling event recognizer 580 remains in the event possible state 584 when it receives sub-event detect finger movement 531-3. As discussed above, however, the definition for a tap concludes with a finger liftoff sub-event, so tap event recognizer 590 transitions to the state event impossible 598.

Finally, sub-event detect finger liftoff 531-4 is delivered to event recognizers 580 and 590. Tap event recognizer is already in the event impossible state 598, and no state transition occurs. Scrolling event recognizer 580's event definition concludes with detecting a finger liftoff. Since the sub-event delivered is detect finger liftoff 531-4, the scrolling event recognizer 580 transitions to state event recognized 586. It is noted that a finger movement on a touch sensitive surface may generate multiple movement sub-events, and therefore a scroll may be recognized before liftoff and continue until liftoff.

The following table presents in summarized tabular format the delivery of sub-event sequence 530 as related to event recognizers 580, 590, and input source handling process 440:

Sub-Event State: Scrolling State: Tap State: Input Sequence Event Recognizer Event Recognizer Source Handling 530 580 590 Process 440 before delivery Event Recogni- Event Recogni- starts tion Begins 582 tion Begins 592 detect finger Event Event Input Sequence down 531-1 Possible 584 Possible 594 Begins 445 measure Event Event Input sequence delay 531-2 Possible 584 Possible 594 continues 450 detect finger Event Event Impossible Input sequence movement Possible 584 598 continues 450 531-3 detect finger Event Recognized Event Impossible Input sequence liftoff 531-4 586 598 ended 455

Turning to FIG. 5C, attention is directed to another example of a sub-event sequence 540, which is being received by a view that includes a plurality of event recognizers. For this example, two event recognizers are depicted in FIG. 5C, double tap event recognizer 570 and tap event recognizer 590. For purposes of illustration, the map view 305 in FIG. 3A will be related to the reception of the sub-event sequence 540, and the state transitions in double tap event recognizer 570 and tap event recognizer 590. Note that in this example, the sequence of sub-events 540 defines a double tap gesture on a touch-sensitive display, but the same event recognition technique could be applied in myriad contexts, e.g., detecting a mouse double click, and/or in embodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to actively involved event recognizers for map view 305, event recognizers 570 and 590 are in the event recognition begins states 572 and 592, respectively. Following delivery of sub-events related to touch sub-event 301 to map view 304 (as described above), double tap event recognizer 570 and tap event recognizer 590 transition to states event possible 574 and 594, respectively. This is because the event definition of a tap and a double tap both begin with a touch such as detecting a finger down 541-1 on a touch-sensitive surface.

As sub-event measure delay 541-2 is delivered to event recognizers 570 and 590, both remain in states event possible 574 and 594, respectively.

Next, sub-event detect finger liftoff 541-3 is delivered to event recognizers 570 and 590. In this case, the state transitions for event recognizers 580 and 590 are different because the exemplar event definitions for tap and double tap are different. In the case of tap event recognizer 590, the final sub-event in the event definition is to detect finger liftoff, so the tap event recognizer 590 transitions to the event recognized state 596.

Double tap recognizer 570 remains in state event possible 574, however, since a delay has begun, regardless of what the user may ultimately do. The complete event recognition definition for a double tap requires another delay, followed by a complete tap sub-event sequence though. This creates an ambiguous situation as between the tap event recognizer 590, which is already in state event recognized 576, and the double tap recognizer 570, which is still in state event possible 574.

Accordingly, in some embodiments, event recognizers may implement exclusivity flags and exclusivity exception lists as discussed above with respect to FIGS. 3B and 3C. Here, the exclusivity flag 324 for tap event recognizer 590 would be set, and additionally, exclusivity exception list 326 for tap event recognizer 590 would be configured to continue permitting delivery of sub-events to some event recognizers (such as double tap event recognizer 570) after tap event recognizer 590 enters the state event recognized 596.

While tap event recognizer 590 remains in state event recognized 596, sub-event sequence 540 continues to be delivered to double tap event recognizer 570, where sub-events measure delay 541-4, detect finger down 541-5, and measure delay 541-6, keep the double tap event recognizer 570 in the state event possible 574; delivery of the final sub-event of sequence 540, detect finger liftoff 541-7 transitions double tap event recognizer 570 to state event recognized 576.

At this point, the map view 305 takes the event double tap as recognized by event recognizer 570, rather than the single tap event recognized by tap event recognizer 590. The decision to take the double tap event is made in light of the combination of the tap event recognizer 590's exclusivity flag 324 being set, the tap event recognizer 590's exclusivity exception list 326 including a double tap event, and the fact that both the tap event recognizer 590 and the double tap event recognizer 570 both successfully recognized their respective event types.

The following table presents in summarized tabular format the delivery of sub-event sequence 540 as related to event recognizers 570 and 590, and sub-event handling process 440:

Sub-Event State: Double Tap State: Tap State: Input Sequence Event Recognizer Event Recognizer Source Handling 540 570 590 Process 440 before delivery Event Recogni- Event Recogni- starts tion Begins 572 tion Begins 592 detect finger Event Event Input Sequence down 541-1 Possible 574 Possible 594 Begins 445 measure Event Event Input sequence delay 541-2 Possible 574 Possible 594 continues 450 detect finger Event Event Recognized Input sequence liftoff 541-3 Possible 574 596 continues 450 measure Event Event Recognized Input sequence delay 541-4 Possible 574 596 continues 450 detect finger Event Event Recognized Input sequence down 541-5 Possible 574 596 continues 450 measure Event Event Recognized Input sequence delay 541-6 Possible 574 596 continues 450 detect finger Event Recognized Event Recognized Input sequence liftoff 541-7 576 596 ended 455

In another embodiment, in the event scenario of FIG. 5C, the single tap gesture is not recognized, because the single tap event recognizer has a wait-for list that identifies the double tap event recognizer. As a result, a single tap gesture is not recognized until (if ever) the double tap event recognizer enters the event impossible state. In this example, in which a double tap gesture is recognized, the single tap event recognizer would remain in the event possible state until the double tap gesture is recognized, at which point the single tap event recognizer would transition to the event impossible state.

Attention is now directed to FIGS. 6A and 6B, which are flow diagrams illustrating an event recognition method in accordance with some embodiments. The method 600 is performed at an electronic device, which in some embodiments, may be an electronic device 102, as discussed above. In some embodiments, the electronic device may include a touch sensitive surface configured to detect multi-touch gestures. Alternatively, the electronic device may include a touch screen configured to detect multi-touch gestures.

The method 600 is configured to execute software that includes a view hierarchy with a plurality of views. The method 600 displays 608 one or more views of the view hierarchy, and executes 610 one or more software elements. Each software element is associated with a particular view, and each particular view includes one or more event recognizers, such as those described in FIGS. 3B and 3C as event recognizer structures 320 and 360, respectively.

Each event recognizer generally includes an event definition based on one or more sub-events, where the event definition may be implemented as a state machine, see e.g., FIG. 3B state machine 340. Event recognizers also generally include an event handler, which specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to the event definition.

In some embodiments, at least one of the plurality of event recognizers is a gesture recognizer having a gesture definition and a gesture handler as noted in step 612 of FIG. 6A.

In some embodiments, the event definition defines a user gesture as noted in step 614 of FIG. 6A.

Alternatively, event recognizers have a set of event recognition states 616. These event recognition states may include at least an event possible state, an event impossible state, and an event recognized state.

In some embodiments, the event handler initiates preparation 618 of its corresponding action for delivery to the target if the event recognizer enters the event possible state. As discussed above with respect to FIG. 4A and the examples in FIGS. 5A-5C, the state machines implemented for each event recognizer generally include an initial state, e.g., state event recognition begins 405. Receiving a sub-event that forms the initial part of an event definition triggers a state change to the event possible state 410. Accordingly, in some embodiments, as an event recognizer transitions from the state event recognition begins 405 to the state event possible 410, the event recognizer's event handler may begin preparing its particular action to deliver to the event recognizer's target after an event is successfully recognized.

On the other hand, in some embodiments, the event handler may terminate preparation 620 of its corresponding action if the event recognizer enters the state event impossible 420. In some embodiments, terminating the corresponding action includes canceling any preparation of the event handler's corresponding action.

The example of FIG. 5B is informative for this embodiment since tap event recognizer 590 may have initiated preparation 618 of its action, but then, once the sub-event detect finger movement 531-3 is delivered to the tap event recognizer 590, the recognizer 590 will transition to the event impossible state 598, 578. At that point, tap event recognizer 590 may terminate preparation 620 of the action for which it had initiated preparation 618.

In some embodiments, the event handler completes preparation 622 of its corresponding action for delivery to the target if the event recognizer enters the event recognized state. The example of FIG. 5C illustrates this embodiment since a double tap is recognized by actively involved event recognizers for the map view 305, which in some implementations, would be the event bound to selecting and/or executing the search result depicted by map view 305. Here, after the double tap event recognizer 570 successfully recognizes the double tap event comprised of the sub-event sequence 540, map view 305's event handler completes preparation 622 of its action, namely, indicating that it has received an activation command.

In some embodiments, the event handler delivers 624 its corresponding action to the target associated with the event recognizer. Continuing with the example of FIG. 5C, the action prepared, i.e. the activation command of the map view 305, would be delivered to the specific target associated with the map view 305, which may be any suitable programmatic method or object.

Alternatively, the plurality of event recognizers may independently process 626 the sequence of one or more sub-events in parallel.

In some embodiments, one or more event recognizers may be configured as exclusive event recognizers 628, as discussed above with respect to FIGS. 3B and 3C's exclusivity flags 324 and 364, respectively. When an event recognizer is configured as an exclusive event recognizer, the event delivery system prevents any other event recognizers for actively involved views (except those listed in the exception list 326, 366 of the event recognizer that recognizes the event) in the view hierarchy from receiving subsequent sub-events (of the same sequence of sub-events) after the exclusive event recognizer recognizes an event. Furthermore, when a non-exclusive event recognizer recognizes an event, the event delivery system prevents any exclusive event recognizers for actively involved views in the view hierarchy from receiving subsequent sub-events, except for those (if any) listed in the exception list 326, 366 of the event recognizer that recognizes the event.

In some embodiments, exclusive event recognizers may include 630 an event exception list, as discussed above with respect to FIGS. 3B and 3C's exclusivity exception lists 326 and 366, respectively. As noted in the discussion of FIG. 5C above, an event recognizer's exclusivity exception list can be used to permit event recognizers to continue with event recognition even when the sequence of sub-events making up their respective event definitions overlap. Accordingly, in some embodiments, the event exception list includes events whose corresponding event definitions have repetitive sub-events 632, such as the single tap/double tap event example of FIG. 5C.

Alternately, the event definition may define a user input operation 634.

In some embodiments, one or more event recognizers may be adapted to delay delivering every sub-event of the sequence of sub-events until after the event is recognized.

The method 600 detects 636 a sequence of one or more sub-events, and in some embodiments, the sequence of one or more sub-events may include primitive touch events 638. Primitive touch events may include, without limitation, basic components of a touch-based gesture on a touch-sensitive surface, such as data related to an initial finger or stylus touch down, data related to initiation of multi-finger or stylus movement across a touch-sensitive surface, dual finger movements in opposing directions, stylus lift off from a touch-sensitive surface, etc.

Sub-events in the sequence of one or more sub-events can include many forms, including without limitation, key presses, key press holds, key press releases, button presses, button press holds, button press releases, joystick movements, mouse movements, mouse button presses, mouse button releases, pen stylus touches, pen stylus movements, pen stylus releases, oral instructions, detected eye movements, biometric inputs, and detected physiological changes in a user, among others.

The method 600 identifies 640 one of the views of the view hierarchy as a hit view. The hit view establishes which views in the view hierarchy are actively involved views. An example is depicted in FIG. 3A, where the actively involved views 303 include search results panel 304, and maps view 305 because touch sub-event 301 contacted the area associated with the maps view 305.

In some embodiments, a first actively involved view within the view hierarchy may be configured 642 to prevent delivery of the respective sub-event to event recognizers associated with that first actively involved view. This behavior can implement the skip property discussed above with respect to FIGS. 3B and 3C (330 and 370, respectively). When the skip property is set for an event recognizer, delivery of the respective sub-event is still performed for event recognizers associated with other actively involved views in the view hierarchy.

Alternately, a first actively involved view within the view hierarchy may be configured 644 to prevent delivery of the respective sub-event to event recognizers associated with that first actively involved view unless the first actively involved view is the hit view. This behavior can implement the conditional skip property discussed above with respect to FIGS. 3B and 3C (332 and 372, respectively).

In some embodiments, a second actively involved view within the view hierarchy is configured 646 to prevent delivery of the respective sub-event to event recognizers associated with the second actively involved view and to event recognizers associated with ancestors of the second actively involved view. This behavior can implement the stop property discussed above with respect to FIGS. 3B and 3C (328 and 368, respectively).

The method 600 delivers 648 a respective sub-event to event recognizers for each actively involved view within the view hierarchy. In some embodiments, event recognizers for actively involved views in the view hierarchy process the respective sub-event prior to processing a next sub-event in the sequence of sub-events. Alternately, event recognizers for the actively involved views in the view hierarchy make their sub-event recognition decisions while processing the respective sub-event.

In some embodiments, event recognizers for actively involved views in the view hierarchy may process the sequence of one or more sub-events concurrently 650; alternatively, event recognizers for actively involved views in the view hierarchy may process the sequence of one or more sub-events in parallel.

In some embodiments, one or more event recognizers may be adapted to delay delivering 652 one or more sub-events of the sequence of sub-events until after the event recognizer recognizes the event. This behavior reflects a delayed event. For example, consider a single tap gesture in a view for which multiple tap gestures are possible. In that case, a tap event becomes a “tap+delay” recognizer. In essence, when an event recognizer implements this behavior, the event recognizer will delay event recognition until it is certain that the sequence of sub-events does in fact correspond to its event definition. This behavior may be appropriate when a recipient view is incapable of appropriately responding to cancelled events. In some embodiments, an event recognizer will delay updating its event recognition status to its respective actively involved view until the event recognizer is certain that the sequence of sub-events does not correspond to its event definition. As discussed above with respect to FIGS. 3B and 3C, delay touch began flag 328, 368, delay touch end flag 330, 370, and touch cancellation flag 332, 372 are provided to tailor sub-event delivery techniques, as well as event recognizer and view status information updates to specific needs.

FIGS. 7A-7S illustrate exemplary user interfaces and user inputs recognized by event recognizers for navigating through concurrently open applications in accordance with some embodiments. The user interfaces in these figures are used to illustrate the processes described below, including the processes in FIGS. 8A-8B, FIGS. 9A-9C, and FIGS. 10A-10B.

Although many of the examples which follow will be given with reference to inputs on touch screen display 156 (where the touch sensitive surface and the display are combined), in some embodiments, the device detects inputs on a touch-sensitive surface that is separate from the display (e.g., a touchpad or trackpad). In some embodiments the touch-sensitive surface has a primary axis that corresponds to a primary axis on the display. In accordance with these embodiments, the device detects contacts with the touch-sensitive surface at locations that correspond to respective locations on the display. In this way, user inputs detected by the device on the touch-sensitive surface are used by the device to manipulate the user interface on the display of the electronic device when the touch-sensitive surface is separate from the display. It should be understood that similar methods may be used for other user interfaces described herein.

FIG. 7A illustrates an exemplary user interface (“home screen” 708) on electronic device 102 in accordance with some embodiments. Similar user interfaces may be implemented on electronic devices 102. In some embodiments, home screen 708 is displayed by an application launcher software application, sometimes called a springboard. In some embodiments, the user interface on touch screen 156 includes the following elements, or a subset or superset thereof:

-   -   Signal strength indicator(s) 702 for wireless communication(s),         such as cellular and Wi-Fi signals;     -   Time 704; and     -   Battery status indicator 706.

The exemplary user interface includes a plurality of application icons 5002 (e.g., 5002-25 through 5002-38). From the home screen 708, a finger gesture can be used to launch an application. For example, tap finger gesture 701 at a location that corresponds to application icon 5002-36 initiates launching an email application.

In FIG. 7B, in response to detecting the finger gesture 701 on application icon 5002-36, the email application is launched and email application view 712-1 is displayed on touch screen 156. A user may launch other applications in a similar manner. For example, a user may press home button 710 from any application view 712 to return to home screen 708 (FIG. 7A), and launch other applications with finger gestures on respective application icons 5002 on home screen 708.

FIGS. 7C-7G illustrate that respective applications are sequentially launched in response to detecting respective finger gestures at locations corresponding to respective application icons 5002 on home screen 708, and that respective user interfaces (i.e., respective application views) are displayed in turn. In particular, FIG. 7C illustrates that media store application view 712-2 is displayed in response to a finger gesture on application icon 5002-32. In FIG. 7D, notes application view 712-3 is displayed in response to a finger gesture on application icon 5002-30. FIG. 7E illustrates that map application view 712-4 is displayed in response to a finger gesture on application icon 5002-27. In FIG. 7F, weather application view 712-5 is displayed in response to a finger gesture on application icon 5002-28. FIG. 7G illustrates that web browser application view 712-6 is displayed in response to a finger gesture on application icon 5002-37. In some embodiments, a sequence of open applications corresponds to the launching of an email application, a media store application, a notes application, a map application, a weather application, and a web browser application.

FIG. 7G also illustrates a finger gesture 703 (e.g., a tap gesture) on a user interface object (e.g., a bookmark icon). In some embodiments, in response to detecting the finger gesture 703 on the bookmark icon, the web browser application displays a list of bookmarks on touch screen 156. Similarly, a user may interact with a displayed application (e.g., the web browser application) with other gestures (e.g., a tap gesture on the address user interface object, which allows the user to type in a new address or modify the displayed address, typically with an on-screen keyboard; a tap gesture on any of links in the displayed web page, which initiates navigating to a web page corresponding to the selected link; etc.).

In FIG. 7G, a first predefined input (e.g., a double-click 705 on home button 710) is detected. Alternatively, a multi-finger swipe gesture (e.g., a three-finger swipe-up gesture as illustrated with movements of finger contacts 707, 709, and 711) is detected on touch screen 156.

FIG. 7H illustrates that, in response to detecting the first predefined input (e.g., double-click 705 or the multi-finger swipe gesture including finger contacts 707, 709, and 711), a portion of web browser application view 712-6 and application icon area 716 are concurrently displayed. In some embodiments, in response to detecting the first predefined input, the device enters into an application view selection mode for selecting one of the concurrently open applications, and the portion of web browser application view 712-6 and application icon area 716 are concurrently displayed as part of the application view selection mode. Application icon area 716 includes a group of open application icons that correspond to at least some of the plurality of concurrently open applications. In this example, the portable electronic device has multiple applications that are concurrently open (e.g., the email application, the media store application, the notes application, the map application, the weather application, and the web browser application), although they are not all simultaneously displayed. As illustrated in FIG. 7H, application icon area 506 includes application icons (e.g., 5004-2, 5004-4, 5004-6, and 5004-8) for the weather application, the map application, the notes application, and the media store application (i.e., four applications that immediately follow the currently displayed application, the web browser application, in the sequence of open applications). In some embodiments, the sequence or order of open application icons displayed in application icon area 716 corresponds to the sequence of open applications in the predetermined sequence (e.g., weather, map, notes, and media store applications).

FIG. 7H also illustrates that gesture 713 (e.g., a tap gesture) is detected on open application icon 5004-8. In some embodiments, in response to detecting gesture 713, a corresponding application view (e.g., media store application view 712-2, FIG. 7C) is displayed.

FIG. 7H illustrates that a left-swipe gesture 715 is detected at a location corresponding to application icon area 716. In FIG. 7I, in response to detecting left-swipe gesture 715, the application icons (e.g., 5004-2, 5004-4, 5004-6, and 5004-8) in application icon area 716 are scrolled. As a result of scrolling, application icon 5004-12 for the email application is displayed in application icon area 506 instead of previously displayed application icons (e.g., 5004-2, 5004-4, 5004-6, and 5004-8).

In FIG. 7J, a gesture of a first type (e.g., a multi-finger left-swipe gesture including movements of finger contacts 717, 719, and 721) is detected on web browser application view 712-6. FIG. 7K illustrates that, in response to detecting the gesture of the first type, weather application view 712-5 is displayed on touch screen 156. It should be noted that the weather application is next to the web browser application in the sequence of open applications.

FIG. 7K also illustrates that a second gesture of the first type (e.g., a multi-finger left-swipe gesture including movements of finger contacts 723, 725, and 727) is detected on weather application view 712-5. FIG. 7L illustrates that, in response to detecting the second gesture of the first type, map application view 712-4 is displayed on touch screen 156. It should be noted that the map application is next to the weather application in the sequence of open applications.

FIG. 7L also illustrates that a third gesture of the first type (e.g., a multi-finger left-swipe gesture including movements of finger contacts 729, 731, and 733) is detected on map application view 712-4. FIG. 7M illustrates that, in response to detecting the third gesture of the first type, notes application view 712-3 is displayed on touch screen 156. It should be noted that the notes application is next to the map application in the sequence of open applications.

FIG. 7M also illustrates that a fourth gesture of the first type (e.g., a multi-finger left-swipe gesture including movements of finger contacts 735, 737, and 739) is detected on notes application view 712-3. FIG. 7N illustrates that, in response to detecting the fourth gesture of the first type, media store application view 712-2 is displayed on touch screen 156. It should be noted that the media store application is next to the notes application in the sequence of open applications.

FIG. 7N also illustrates that a fifth gesture of the first type (e.g., a multi-finger left-swipe gesture including movements of finger contacts 741, 743, and 745) is detected on media store application view 712-2. FIG. 7O illustrates that, in response to detecting the fifth gesture of the first type, email application view 712-1 is displayed on touch screen 156. It should be noted that the email application is next to the media store application in the sequence of open applications.

FIG. 7O also illustrates that a sixth gesture of the first type (e.g., a multi-finger left-swipe gesture including movements of finger contacts 747, 749, and 751) is detected on email application view 712-1. FIG. 7P illustrates that, in response to detecting the sixth gesture of the first type, web browser application view 712-6 is displayed on touch screen 156. It should be noted that the web browser application is on one end of the sequence of open applications, and the email application is on the opposite end of the sequence of open applications.

FIG. 7P also illustrates that a gesture of a second type (e.g., a multi-finger right-swipe gesture including movements of finger contacts 753, 755, and 757) is detected on web browser application view 712-6. FIG. 7Q illustrates that, in some embodiments, in response to detecting the gesture of the second type, email application view 712-1 is displayed on touch screen 156.

Referring to FIG. 7R, a multi-finger gesture (e.g., a five-finger pinch gesture including movements of finger contacts 759, 761, 763, 765, and 767) is detected on web browser application view 712-6. FIG. 7S illustrates that, while detecting the multi-finger gesture on touch screen 156, web browser application view 712-6 and at least a portion of home screen 708 are concurrently displayed. As illustrated, web browser application view 712-6 is displayed at a reduced scale. The reduced scale is adjusted in accordance with the multi-finger gesture while the multi-finger gesture is detected on the touch screen 156. For example, the reduced scale decreases with further pinching of finger contacts 759, 761, 763, 765, and 767 (i.e., web browser application view 712-6 is displayed at a smaller scale). Alternatively, the reduced scale increases with depinching of finger contacts 759, 761, 763, 765, and 767 (i.e., web browser application view 712-6 is displayed at a larger scale than before).

In some embodiments, when the multi-finger gesture ceases to be detected, web browser application view 712-6 ceases to be displayed, and the entire home screen 708 is displayed. Alternatively, when the multi-finger gesture ceases to be detected, it is determined whether the entire home screen 708 is to be displayed or web browser application view 712-6 is to be displayed at a full-screen scale. In some embodiments, the determination is made based on the reduced scale when the multi-finger gesture ceases to be displayed (e.g., if the application view is displayed at a scale smaller than a predefined threshold when the multi-finger gesture ceases to be detected, the entire home screen 708 is displayed; if the application view is displayed at a scale larger than the predefined threshold when the multi-finger gesture ceases to be detected, the application view is displayed at a full-screen scale without a display of home screen 708). In some embodiments, the determination is made also based on the speed of the multi-finger gesture.

FIGS. 8A and 8B are flow diagrams illustrating event recognition method 800 in accordance with some embodiments. Method 800 is performed (802) at an electronic device with a touch-sensitive display (e.g., device 102, FIG. 1B). The electronic device is configured to execute at least a first software application and a second software application. The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers (e.g., application 133-2 has gesture recognizer 516-4, and application 133-1 has gesture recognizers 516-1 through 516-3 and views 508, 510, and 512, FIG. 3F). Respective gesture recognizers have corresponding gesture handlers (e.g., gesture handler 552-1 corresponds to gesture recognizer 516-1 and gesture handler 552-3 corresponds to gesture recognizer 516-4). The first set of one or more gesture recognizers is typically different from the second set of one or more gesture recognizers.

Method 800 allows a user to control with a gesture a hidden open application that is not currently displayed on a display of the electronic device (e.g., the first software application), such as a background application, a suspended application, or a hibernated application. Thus, the user can perform operations that are not provided by the application currently displayed on the display of the electronic device (e.g., the second software application) but are provided by one of the currently open applications (e.g., displaying a home screen or switching to a next software application using gestures for a hidden application launcher software application).

In some embodiments, the first software application is (804) an application launcher (e.g., a springboard). For example, as shown in FIG. 7A, the application launcher displays a plurality of application icons 5002 that correspond to a plurality of applications. The application launcher receives a user-selection of an application icon 5002 (e.g., based on a finger gesture on touch screen 156), and in response to receiving the user-selection, launches an application corresponding to the selected application icon 5002.

The second software application is typically a software application launched by the application launcher. As illustrated in FIGS. 7A and 7B, the application launcher receives information about tap gesture 701 on email application icon 5002-36, and launches an email application. In response, the email application displays email application view 712-1 on touch screen 156. The second application may be any application that corresponds to application icons 5002 (FIG. 7A) or any other application that can be launched by the application launcher (e.g., media store application, FIG. 7C; notes application, FIG. 7D; map application, FIG. 7E; weather application, 7F; web browser application, FIG. 7G; etc.). In the following description of method 800, an application launcher is used as an exemplary first software application and a web browser application is used as an exemplary second software application.

In some embodiments, the electronic device has only two software applications in the programmatic hierarchy: an application launcher and one other software application (typically a software application corresponding to one or more views displayed on touch screen 156 of electronic device 102).

In some embodiments, the first software application is (806) an operating system application. As used herein, an operating system application refers to an application that is integrated with an operating system 118 (FIGS. 1A-1C). An operating system application typically resides in core OS level 208 or operating system API software 206 in FIG. 2. An operating system application is typically not removable by a user, whereas other applications typically may be installed or removed by the user. In some embodiments, the operating system application includes the application launcher. In some embodiments, the operating system application includes a settings application (e.g., an application for displaying/modifying system settings or one or more values in device/global internal state 134, FIG. 1C). In some embodiments, the operating system application includes accessibility module 127. In some embodiments, the electronic device has only three software applications in the programmatic hierarchy: an application launcher, a settings application, and one other application (typically a software application corresponding to one or more views displayed on touch screen 156 of electronic device 102).

The electronic device displays (808) at least a subset of the one or more views of the second software application (e.g., web browser application view 712-6, FIG. 7G).

In some embodiments, the displaying includes (810) displaying at least a subset of the one or more views of the second software application without displaying any view of the first software application. For example, in FIG. 7G, no view of the application launcher (e.g., home screen 708) is displayed.

In some embodiments, the displaying includes (812) displaying at least a subset of the one or more views of the second software application without displaying a view of any other application. For example, in FIG. 7G, only one or more views of the web browser application are displayed.

While displaying at least the subset of the one or more views of the second software application, the electronic device detects (814) a sequence of touch inputs on the touch-sensitive display (e.g., gesture 703, which includes a touch-down event and a touch-up event; or another gesture, which includes touch-down of finger contacts 707, 709, and 711, movements of finger contacts 707, 709, and 711 across touch screen 156, and lift-off of finger contacts 707, 709, and 711). The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion. As used herein, the term “sequence” refers to the order in which one or more touch events happens. For example, in the sequence of touch inputs including finger contacts 707, 709, and 711, the first portion may include the touch-down of finger contacts 707, 709, and 711, and the second portion may include the movements of finger contacts 707, 709, and 711, and lift-off of finger contacts 707, 709, and 711.

In some embodiments, the detecting occurs (816) while touch inputs in the first portion of one or more touch inputs at least partially overlap at least one of the displayed views of the second software application. In some embodiments, even though the touch inputs at least partially overlap at least one of the displayed views of the second software application, the first software application receives the first portion of one or more touch inputs. For example, the application launcher receives the first portion of touch inputs on the displayed views of the web browser (FIG. 7G), even though the application launcher is not displayed.

During a first phase of detecting the sequence of touch inputs (818), the electronic device delivers (820) the first portion of one or more touch inputs to the first software application and the second software application (e.g., using event dispatcher module 315, FIG. 3D), identifies (822) from gesture recognizers in the first set, one or more matching gesture recognizers that recognize the first portion of one or more touch inputs (e.g., using event comparator 3033 in each gesture recognizer (typically, each receiving gesture recognizer) in the first set, FIG. 3D), and processes (824) the first portion of one or more touch inputs with one or more gesture handlers corresponding to the one or more matching gesture recognizers (e.g., activating corresponding event handler(s) 319, FIG. 3D).

In some embodiments, the first phase of detecting the sequence of touch inputs is a phase of detecting the first portion of one or more touch inputs.

Regarding the delivering operation (820), in some embodiments, the first software application, after receiving the first portion of one or more inputs, delivers the first portion of one or more touch inputs to at least a subset of gesture recognizers in the first set, and the second software application, after receiving the first portion of one or more inputs, delivers the first portion of one or more touch inputs to at least a subset of gesture recognizers in the second set. In some embodiments, the electronic device or an event dispatcher module (e.g., 315, FIG. 3D) in the electronic device delivers the first portion of one or more touch inputs to at least a subset of gesture recognizers in the first set and the second set (e.g., event dispatcher module 315 delivers the first portion of one or more touch inputs to gesture recognizers 516-1, 516-2, and 516-4, FIG. 3F).

For example, when the finger gesture including finger contacts 707, 709, and 711 is detected on touch screen 156 (FIG. 7G), the touch-down event is delivered to one or more gesture recognizers of the application launcher and one or more gesture recognizers of the web browser application. In another example, a touch-down event of tap gesture 703 (FIG. 7G) is delivered to one or more gesture recognizers of the application launcher and one or more gesture recognizers of the web browser application.

In some embodiments, when no gesture recognizer in the first set recognizes the first portion of one or more touch inputs (e.g., a mismatch between detected events and the gesture definition or the gesture is not completed), processing the first portion of one or more touch inputs includes performing a null operation (e.g., the device does not update the displayed user interface).

In some embodiments, the electronic device identifies from gesture recognizers in the second set, one or more matching gesture recognizers that recognizer the first portion of one or more touch inputs. The electronic device processes the first portion of one or more touch inputs with one or more gesture handlers corresponding to the one or more matching gesture recognizers. For example, in response to tap gesture 703 (FIG. 7G) delivered to one or more gesture recognizers of the web browser application, a matching gesture recognizer in the web browser application (e.g., a gesture recognizer that recognizes a tap gesture on the bookmark icon, FIG. 7G) processes tap gesture 703 by displaying a list of bookmarks on touch screen 156.

In some embodiments, during a second phase of detecting the sequence of touch inputs, subsequent to the first phase, the electronic device delivers (826, FIG. 8B) the second portion of one or more touch inputs to the first software application without delivering the second portion of one or more touch inputs to the second software application (e.g., using event dispatcher module 315, FIG. 3D), identifies from the one or more matching gesture recognizers a second matching gesture recognizer that recognizes the sequence of touch inputs (e.g., using event comparator 3033 in each matching gesture recognizer, FIG. 3D), and processes the sequence of touch inputs with a gesture handler corresponding to the respective matching gesture recognizer. In some embodiments, the second phase of detecting the sequence of touch inputs is a phase of detecting the second portion of one or more touch inputs.

For example, when the finger gesture including finger contacts 707, 709, and 711 is detected on touch screen 156 (FIG. 7G), the touch movement and lift-off events are delivered to one or more gesture recognizers of the application launcher without delivering the touch events to the web browser application. The electronic device identifies a matching gesture recognizer (e.g., a three-finger swipe-up gesture recognizer) of the application launcher, and processes the sequence of touch inputs with a gesture handler corresponding to the three-finger swipe-up gesture recognizer.

The second software application does not receive the second portion of one or more touch inputs during the second phase, typically because the first software application has a priority over the second software application (e.g., in the programmatic hierarchy). Thus, in some embodiments, when a gesture recognizer in the first software application recognizes the first portion of one or more touch inputs, the one or more gesture recognizers in the first software application exclusively receive the second subsequent portion of one or more touch inputs. In addition, the second software application may not receive the second portion of one or more touch inputs during the second phase, because no gesture recognizer in the second software application matches the first portion of one or more touch inputs.

In some embodiments, processing the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer includes (834) displaying in a first predefined area of the touch-sensitive display a group of open application icons that correspond to at least some of a plurality of concurrently open applications, and concurrently displaying at least a subset of the one or more views of the second software application. For example, in FIG. 7H, application icons 5004 in predefined area 716 corresponds to concurrently open applications of the electronic device. In some embodiments, application icons 5004 in predefined area 716 are displayed in accordance with a sequence of open applications. In FIG. 7H, the electronic device concurrently displays predefined area 716 and a subset of web browser application view 712-6.

In some embodiments, processing the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer includes (828) displaying one or more views of the first software application. For example, in response to a multi-finger pinch gesture (FIG. 7R), the electronic device displays home screen 708 (FIG. 7A). In some embodiments, displaying the one or more views of the first software application includes displaying the one or more views of the first software application without concurrently displaying a view corresponding to any other software application (e.g., FIG. 7A).

In some embodiments, processing the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer includes (830) replacing the display of the one or more views of the second software application with display of one or more views of the first software application (e.g., displaying home screen 708, FIG. 7A). Thus, the one or more views of the second software application ceases to be displayed after the one or more views of the first software application are displayed. In some embodiments, replacing the display of the one or more views of the second software application with display of one or more views of the first software application includes displaying the one or more views of the first software application without concurrently displaying a view corresponding to any other software application (FIG. 7A).

In some embodiments, the electronic device concurrently executes (832) the first software application, the second software application, and a third software application. In some embodiments, processing the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer includes replacing the one or more displayed views of the second software application with one or more views of the third software application. For example, in response to a multi-finger swipe gesture, the electronic device replaces the display of web browser application view 712-6 with a display of weather application view 712-5 (FIGS. 7J-7K). In some embodiments, replacing the one or more displayed views of the second software application with one or more views of the third software application includes displaying the one or more views of the third software application without concurrently displaying a view corresponding to any other software application. In some embodiments, the third software application is next to the second software application in the sequence of open applications.

In some embodiments, processing the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer includes launching a settings application. For example, in response to a ten-finger tap gesture, the electronic device launches the settings application.

Note that details of the processes described above with respect to method 800 are also applicable in an analogous manner to method 900 described below. For brevity, these details are not repeated below.

FIGS. 9A-9C are flow diagrams illustrating event recognition method 900 in accordance with some embodiments. Method 900 is performed (902) at an electronic device with a touch-sensitive display. The electronic device is configured to execute at least a first software application and a second software application. The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. In some embodiments, the first set of one or more gesture recognizers is different from the second set of one or more gesture recognizers.

Method 900 allows a user to control with a gesture a hidden open application that is not currently displayed on a display of the electronic device (e.g., the first software application), such as a background application, a suspended application, or a hibernated application Thus, the user can perform operations that are not provided by the application currently displayed on the display of the electronic device (e.g., the second software application) but are provided by one of the currently open applications (e.g., displaying a home screen or switching to a next software application using gestures for a hidden application launcher software application).

In some embodiments, the first software application is (904) an application launcher (e.g., a springboard). In some embodiments, the first software application is (906) an operating system application. In the following description of method 900, an application launcher is used as an exemplary first software application and a web browser application is used as an exemplary second software application.

The electronic device displays (908) a first set of one or more views (e.g., web browser application view 712-6, FIG. 7G). The first set of one or more views includes at least a subset of the one or more views of the second software application. For example, the second software application may have a plurality of application views (e.g., application views 317 of application 133-1, FIG. 3D), and the electronic device displays at least one view of the plurality of application views. In some embodiments, the subset includes the entire one or more views of the second software application.

In some embodiments, displaying the first set of one or more views includes (910) displaying the first set of one or more views without displaying any view of the first software application (e.g., web browser application view 712-6, FIG. 7G).

In some embodiments, displaying the first set of one or more views includes (912) displaying the first set of one or more views without displaying a view of any other software application. For example, in FIG. 7G, only one or more views of the web browser application are displayed.

While displaying the first set of the one or more views, the electronic device detects (914) a sequence of touch inputs on the touch-sensitive display, and determines (920) whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs. For example, while displaying web browser application view 712-6 (FIG. 7G), the device determines whether gesture recognizers for the application launcher recognizes the first portion of the touch inputs. The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion (i.e., the second portion is after the first portion).

In some embodiments, the sequence of touch inputs at least partially overlaps (916) at least one of the one or more displayed views of the second software application. For example, the application launcher receives the first portion of touch inputs on web browser application view 712-6 (FIG. 7G), even though the application launcher is not displayed.

In some embodiments, prior to a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs, the electronic device concurrently delivers (918) the first portion of one or more touch inputs to the first software application and the second software application. For example, both the application launcher and the web browser application receive the touch-down event of finger contacts 707, 709, and 711 (FIG. 7G) prior to a determination that at least one gesture recognizer in the application launcher recognizes the touch-down event.

In accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs (922, FIG. 9B), the electronic device delivers (924) the sequence of touch inputs to the first software application without delivering the sequence of touch inputs to the second software application, determines (926) whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs, and in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs, processes (928) the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers that recognizes the sequence of touch inputs.

For example, when the touch-down and touch-movement of three finger contacts 707, 709, and 711 are detected on touch screen 156 (FIG. 7G), the electronic device identifies that at least a three-finger swipe-up gesture recognizer of the application launcher recognizes the touch inputs. Thereafter, the electronic device delivers subsequent touch events (e.g., lift-off of finger contact 707, 709, and 711) to the application launcher without delivering the subsequent touch events to the web browser application. The electronic device further identifies that the three-finger swipe-up gesture recognizer recognizes the sequence of touch inputs, and processes the sequence of touch inputs with a gesture handler corresponding to the three-finger swipe-up gesture recognizer.

In some embodiments, processing the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers includes (930) displaying one or more views of the first software application. For example, in response to detecting a multi-finger pinch gesture (FIG. 7R), the electronic device displays home screen 708 (FIG. 7A).

In some embodiments, processing the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers includes (932) replacing the display of the first set of one or more views with display of one or more views of the first software application (e.g., displaying home screen 708, FIG. 7A, which is part of the application launcher software application).

In some embodiments, the electronic device concurrently executes the first software application, the second software application, and a third software application; and processing the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers includes (934) replacing the first set of one or more views with one or more views of the third software application. In some embodiments, replacing the first set of one or more views with one or more views of the third software application includes displaying the one or more views of the third software application without concurrently displaying a view corresponding to any other software application. For example, in response to a multi-finger swipe gesture, the electronic device replaces the display of web browser application view 712-6 with a display of weather application view 712-5 (FIGS. 7J-7K).

In some embodiments, processing the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers includes (936) displaying in a first predefined area of the touch-sensitive display a group of open application icons that correspond to at least some of a plurality of concurrently open applications, and concurrently displaying at least a subset of the first set of one or more views. For example, in FIG. 7H, application icons 5004 in predefined area 716 corresponds to concurrently open applications of the electronic device. In some embodiments, application icons 5004 in predefined area 716 are displayed in accordance with a sequence of open applications. In FIG. 7H, the electronic device concurrently displays predefined area 716 and a subset of web browser application view 712-6.

In accordance with a determination that no gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs (938, FIG. 9C), the electronic device delivers (940) the sequence of touch inputs to the second software application, determines (942) whether at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs, and in accordance with a determination that at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs, processes (944) the sequence of touch inputs with the at least one gesture recognizer in the second set of one or more gesture recognizers that recognizes the sequence of touch inputs.

For example, when the first portion of one or more touch inputs is tap gesture (e.g., 703, FIG. 7G), and no gesture recognizer in the application launcher recognizes the tap gesture, the electronic device delivers the tap gesture to the web browser application, and determines whether at least one gesture recognizer of the web browser application recognizes the tap gesture. When the web browser application (or a gesture recognizer of the web browser application) recognizes tap gesture 703 on the bookmark icon, the electronic device processes tap gesture 703 with a corresponding gesture handler.

FIGS. 10A-10B are flow diagrams illustrating an event recognition method in accordance with some embodiments. Note that details of the processes described above with respect to methods 600, 800, and 900 are also applicable in an analogous manner to method 1000 described below. For brevity, these details are not repeated below.

Method 1000 is performed (1002) at an electronic device with an internal state (e.g., device/global internal state 134, FIG. 1C). The electronic device is configured to execute software that includes a view hierarchy with a plurality of views.

In method 1000, at least one gesture recognizer has a plurality of gesture definitions. This helps the gesture recognizer work in different distinct operating modes. For example, a device may have a normal operating mode and an accessibility operating mode. In the normal operating mode, a next application gesture is used to move between applications, and the next application gesture is defined as a three-finger left-swipe gesture. In the accessibility operating mode, the three-finger left-swipe gesture is used to perform a different function. Thus, a gesture different from the three-finger left-swipe is needed in the accessibility operating mode to correspond to the next application gesture (e.g., a four-finger left-swipe gesture in the accessibility operating mode). By having multiple gesture definitions associated with the next application gesture, the device can select one of the gesture definitions for the next application gesture, depending on the current operating mode. This provides flexibility in using the gesture recognizer in different operating modes. In some embodiments, a plurality of gesture recognizers with multiple gesture definitions is adjusted depending on the operating mode (e.g., gestures performed with three fingers in the normal operating mode are performed with four fingers in the accessibility operating mode).

In some embodiments, the internal state includes (1016) one or more settings for an accessibility operating mode (e.g., the internal state indicates whether the device is operating in the accessibility operating mode).

In some embodiments, the software is (1018) or includes an application launcher (e.g., a springboard).

In some embodiments, the software is (1020) or includes an operating system application (e.g., an application integrated with an operating system of the device).

The electronic device displays (1004) one or more views of the view hierarchy.

The electronic device executes (1006) one or more software elements. Each software element is associated with a particular view (e.g., application 133-1 has one or more application views 317, FIG. 3D), and each particular view includes one or more event recognizers (e.g., event recognizers 325, FIG. 3D). Each event recognizer has one or more event definitions based on one or more sub-events, and an event handler (e.g., gesture definitions 3035 and a reference to a corresponding event handler in event delivery information 3039, FIG. 3D). The event handler specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions (e.g., an event definition selected from the one or more event definitions when the event recognizer has multiple event definitions, or a sole event definition when the event recognizer has only one event definition).

The electronic device detects (1008) a sequence of one or more sub-events.

The electronic device identifies (1010) one of the views of the view hierarchy as a hit view. The hit view establishes which views in the view hierarchy are actively involved views.

The electronic device delivers (1012) a respective sub-event to event recognizers for each actively involved view within the view hierarchy. In some embodiments, the one or more actively involved views in the view hierarchy include the hit view. In some embodiments, the one or more actively involved views in the view hierarchy include a default view (e.g., home screen 708 of the application launcher).

At least one event recognizer for actively involved views in the view hierarchy has (1014) a plurality of event definitions, one of which is selected in accordance with the internal state of the electronic device. For example, event recognizer 325-1 has a plurality of gesture definitions (e.g., 3037-1 and 3037-2, FIG. 3D). In some embodiments, event recognizer 325-1 selects one of the plurality of gesture definitions in event recognizer 325-1 based on one or more values in device/global internal state 134 (FIG. 1C). The at least one event recognizer then processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition. In some embodiments, each of two or more event recognizers for actively involved views in the view hierarchy has a plurality of event definitions, one of which is selected in accordance with the internal state of the electronic device. In such embodiments, at least one of the two or more event recognizers processes the respective sub-event prior to processing the next sub-event in the sequence of sub-events in accordance with the selected event definition.

For example, FIGS. 7J-7K illustrate a next-application gesture that initiates displaying an application view of a next application. In some embodiments, the application launcher includes a next-application gesture recognizer, which includes a gesture definition that matches a three-finger left-swipe gesture. For purposes of this example, assume that the next-application gesture recognizer also includes a gesture definition that corresponds to a four-finger left-swipe gesture. When one or more values in device/global internal state 134 are set to default value(s), the next-application gesture recognizer uses the three-finger left-swipe gesture definition and does not use the four-finger left-swipe gesture definition. When the one or more values in device/global internal state 134 are modified (e.g., by using accessibility module 127, FIG. 1C), the next-application gesture recognizer uses the four-finger left-swipe gesture definition and does not use the three-finger left-swipe gesture definition. Thus, in this example, when the one or more values in device/global internal state 134 are modified, a four-finger left-swipe gesture initiates displaying an application view of a next application.

Similarly, FIGS. 7R-7S illustrate that a home screen gesture initiates displaying web browser application view 712-6 at a reduced scale and displaying at least a portion of home screen 708 in response to detecting a five-finger pinch gesture. Based on device/global internal state 134 and gesture definitions in a home screen gesture recognizer, a four-finger pinch gesture, a three-finger pinch gesture, or any other suitable gesture may be used to initiate displaying web-browser application view 712-6 at a reduced scale and displaying at least a portion of home screen 708.

In some embodiments, the plurality of event definitions includes (1020) a first event definition corresponding to a first swipe gesture with a first number of fingers and a second event definition corresponding to a second swipe gesture with a second number of fingers distinct from the first number of fingers. For example, the plurality of event definitions for a respective gesture recognizer may include a three-finger swipe gesture and a four-finger swipe gesture.

In some embodiments, the plurality of event definitions includes a first event definition corresponding a first gesture of a first kind with a first number of fingers and a second event definition corresponding to a second gesture of the first kind with a second number of fingers distinct from the first number of fingers (e.g., a one-finger tap gesture and a two-finger tap gesture, a two-finger pinch gesture and a three-finger pinch gesture, etc.).

In some embodiments, the plurality of event definitions includes a first event definition corresponding to a first gesture and a second event definition corresponding to a second gesture distinct from the first gesture (e.g., a swipe gesture and a pinch gesture, a swipe gesture and a tap gesture, etc.).

In some embodiments, a respective definition of the plurality of event definitions is selected (1022) for a respective event recognizer in accordance with the internal state of the electronic device and a determination (by the electronic device) that the respective event definition does not correspond to an event definition of any event recognizer for the actively involved views other than the respective event recognizer.

For example, a respective gesture recognizer may have two event definitions: a first event definition corresponding to a three-finger left swipe gesture that is typically used for a normal operating mode and a second event definition corresponding to a four-finger left swipe gesture that is typically used for an accessibility operating mode. When the internal state of the electronic device is set in a way such that the electronic device operates in the accessibility mode, the electronic device determines whether the four-finger left swipe gesture for the second event definition is used by any other event recognizer for the actively involved views. If the four-finger left swipe gesture is not used by any other event recognizer for the actively involved views, the four-finger left swipe gesture is selected for the respective gesture recognizer in the accessibility operating mode. On the other hand, if the four-finger left swipe gesture is used by any other event recognizer for the actively involved views, the three-finger left swipe gesture is used for the respective gesture recognizer even in the accessibility operating mode. This prevents two or more gesture recognizers from undesirably responding to a same gesture.

In some embodiments, a respective definition of the plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination (by the electronic device) that the respective event definition does not correspond to an event definition of any event recognizer (including event recognizers for the actively involved views and any other views) other than the respective event recognizer.

In some embodiments, two or more event recognizers for actively involved views in the view hierarchy each have (1024) a respective plurality of event definitions, and a respective event definition of the respective plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination (by the electronic device) that the respective event definition does not correspond to any event definition selected for any event recognizer with two or more event definitions other than the respective event recognizer.

For example, actively involved views may have a first gesture recognizer and a second gesture recognizer. In this example, the first gesture recognizer has: a first event definition corresponding to a three-finger left swipe gesture that is typically used for a normal operating mode and a second event definition corresponding to a four-finger left swipe gesture that is typically used for an accessibility operating mode. The second gesture recognizer has: a third event definition corresponding to a two-finger left swipe gesture that is typically used for the normal operating mode and a fourth event definition corresponding to the four-finger left swipe gesture that is typically used for the accessibility operating mode. When the internal state of the electronic device is set in a way such that the electronic device operates in the accessibility mode, the electronic device determines whether a four-finger left swipe gesture that satisfies the second event definition is selected for any other event recognizer with two or more event definitions (e.g., the second event gesture recognizer). If the four-finger left swipe gesture is not selected for any other event recognizer with two or more event definitions, the four-finger left swipe gesture is selected for the first gesture recognizer in the accessibility operating mode. As a result, the four-finger left swipe gesture is not selected for the second gesture recognizer, because the four-finger left swipe gesture is already selected for the first gesture recognizer. Instead, the two-finger left swipe gesture is selected for the second gesture recognizer, because the two-finger left swipe gesture is not selected for any other gesture recognizer with two or more event definitions including the first gesture recognizer. In another example, the actively involved views have the first gesture recognizer and a third gesture recognizer without the second gesture recognizer. The third gesture recognizer has the third event definition (corresponding to the two-finger left swipe gesture) that is typically used for the normal operating mode and a fifth event definition corresponding to a three-finger left swipe gesture that is typically used for the accessibility operating mode. In the accessibility operating mode, the three-finger left swipe gesture can be selected for the third gesture recognizer, because the three-finger left swipe gesture is not selected for any other gesture recognizer with two or more event definitions.

Although the examples above have been described with respect to multi-finger left swipe gestures, the methods described above apply to swipe gestures in any direction (e.g., a swipe-right gesture, swipe-up gesture, swipe-down gesture, and/or any diagonal swipe gesture) or gestures of any other kinds (e.g., tap gestures, pinch gestures, depinch gestures, etc.).

In some embodiments, processing the respective sub-event in accordance with the selected event definition includes (1026) displaying one or more views of a first software application distinct from the software that includes the view hierarchy (e.g., concurrently displaying at least a portion of user interface 712-6 including one or more views of the software and a portion of home screen 708, FIG. 7S).

In some embodiments, the at least one event recognizer processes (1028) the respective sub-event by replacing the display of the one or more views of the view hierarchy with display of one or more views of a first software application (e.g., home screen 708, FIG. 7A) distinct from the software that includes the view hierarchy.

In some embodiments, the at least one event recognizer processes (1030) the respective sub-event by: displaying in a first predefined area of a display in the electronic device a group of open application icons that correspond to at least some of a plurality of concurrently open applications; and concurrently displaying at least a subset of the one or more views of the view hierarchy (e.g., open application icons 5004 and at least a portion of user interface 712-6, FIG. 7H). For example, the electronic device concurrently displays the group of open application icons and at least a subset of the one or more views of the view hierarchy in response to a three-finger swipe-up gesture in the normal operating mode and a four-finger swipe-up gesture in the accessibility operating mode.

In accordance with some embodiments, FIG. 11 shows a functional block diagram of an electronic device 1100 configured in accordance with the principles of the invention as described above. The functional blocks of the device may be implemented by hardware, software, or a combination of hardware and software to carry out the principles of the invention. It is understood by persons of skill in the art that the functional blocks described in FIG. 11 may be combined or separated into sub-blocks to implement the principles of the invention as described above. Therefore, the description herein may support any possible combination or separation or further definition of the functional blocks described herein.

As shown in FIG. 11, an electronic device 1100 includes a touch-sensitive display unit 1102 configured to receive touch inputs; and a processing unit 1106 coupled to the touch-sensitive display unit 1102. In some embodiments, the processing unit 1106 includes an executing unit 1108, a display enabling unit 1110, a detecting unit 1112, a delivering unit 1114, an identifying unit 1116, and a touch input processing unit 1118.

The processing unit 1106 is configured to: execute at least a first software application and a second software application (e.g., with the executing unit 1108). The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. The processing unit 1106 is configured to enable display of at least a subset of the one or more views of the second software application (e.g., with the display enabling unit 1110, on the touch-sensitive display unit 1102). The processing unit 1106 is configured to, while displaying at least the subset of the one or more views of the second software application: detect a sequence of touch inputs on the touch-sensitive display unit 1102 (e.g., with the detecting unit 1112). The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion. The processing unit 1106 is configured to, during a first phase of detecting the sequence of touch inputs: deliver the first portion of one or more touch inputs to the first software application and the second software application (e.g., with the delivering unit 1114); identify from gesture recognizers in the first set one or more matching gesture recognizers that recognize the first portion of one or more touch inputs (e.g., with the identifying unit 1116); and process the first portion of one or more touch inputs with one or more gesture handlers corresponding to the one or more matching gesture recognizers (e.g., with the touch input processing unit 1118).

In some embodiments, the processing unit 1106 is configured to detect the sequence of touch inputs (e.g., with the detecting unit 1112) while touch inputs in the first portion of one or more touch inputs at least partially overlap at least one of the displayed views of the second software application.

In some embodiments, the processing unit 1106 is configured to enable display of at least a subset of the one or more views of the second software application without displaying any view of the first software application (e.g., with the display enabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to enable display of at least a subset of the one or more views of the second software application without displaying a view of any other application (e.g., with the display enabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to, during a second phase of detecting the sequence of touch inputs, subsequent to the first phase: deliver the second portion of one or more touch inputs to the first software application without delivering the second portion of one or more touch inputs to the second software application (e.g., with the delivering unit 1114); identify from the one or more matching gesture recognizers a second matching gesture recognizer that recognizes the sequence of touch inputs (e.g., with the identifying unit 1116); and process the sequence of touch inputs with a gesture handler corresponding to the respective matching gesture recognizer (e.g., with the touch input processing unit 1118).

In some embodiments, the processing unit 1106 is configured to process the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer by enabling display of one or more views of the first software application (e.g., with the display enabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to process the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer by replacing the display of the one or more views of the second software application with display of one or more views of the first software application (e.g., with the display enabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to: concurrently execute the first software application, the second software application, and a third software application (e.g., with the executing unit 1108); and process the sequence of touch inputs with the gesture handler corresponding to the respective matching gesture recognizer by replacing the one or more displayed views of the second software application with one or more views of the third software application (e.g., with the display enabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to: enable display of, in a first predefined area of the touch-sensitive display unit 1102, a group of open application icons that correspond to at least some of a plurality of concurrently open applications (e.g., with the display enabling unit 1110); and enable concurrent display of at least a subset of the one or more views of the second software application (e.g., with the display enabling unit 1110).

In some embodiments, the first software application is an application launcher.

In some embodiments, the first software application is an operating system application.

In accordance with some embodiments, FIG. 12 shows a functional block diagram of an electronic device 1200 configured in accordance with the principles of the invention as described above. The functional blocks of the device may be implemented by hardware, software, or a combination of hardware and software to carry out the principles of the invention. It is understood by persons of skill in the art that the functional blocks described in FIG. 12 may be combined or separated into sub-blocks to implement the principles of the invention as described above. Therefore, the description herein may support any possible combination or separation or further definition of the functional blocks described herein.

As shown in FIG. 12, an electronic device 1200 includes a touch-sensitive display unit 1202 configured to receive touch inputs; and a processing unit 1206 coupled to the touch-sensitive display unit 1202. In some embodiments, the processing unit 1206 includes an executing unit 1208, a display enabling unit 1210, a detecting unit 1212, a determining unit 1214, a delivering unit 1216, and a touch input processing unit 1218.

The processing unit 1206 is configured to execute at least a first software application and a second software application (e.g., with the executing unit 1208). The first software application includes a first set of one or more gesture recognizers, and the second software application includes one or more views and a second set of one or more gesture recognizers. Respective gesture recognizers have corresponding gesture handlers. The processing unit 1206 is configured to enable display of a first set of one or more views (e.g., with the display enabling unit 1210). The first set of one or more views include at least a subset of the one or more views of the second software application. The processing unit 1206 is configured to, while displaying the first set of the one or more views, detect a sequence of touch inputs on the touch-sensitive display unit (e.g., with the detecting unit 1212). The sequence of touch inputs includes a first portion of one or more touch inputs and a second portion of one or more touch inputs subsequent to the first portion. The processing unit 1206 is configured to determine whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs (e.g., with the determining unit 1214). The processing unit 1206 is configured to, in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs: deliver the sequence of touch inputs to the first software application without delivering the sequence of touch inputs to the second software application (e.g., with the delivering unit 1216); determine whether at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs (e.g., with the determining unit 1214). The processing unit 1206 is configured to, in accordance with a determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the sequence of touch inputs, process the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers that recognizes the sequence of touch inputs (e.g., with the touch input processing unit 1218). The processing unit 1206 is configured to, in accordance with a determination that no gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs: deliver the sequence of touch inputs to the second software application (e.g., with the delivering unit 1216); and determine whether at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs (e.g., with the determining unit 1214). The processing unit 1206 is configured to, in accordance with a determination that at least one gesture recognizer in the second set of one or more gesture recognizers recognizes the sequence of touch inputs, process the sequence of touch inputs with the at least one gesture recognizer in the second set of one or more gesture recognizers that recognizes the sequence of touch inputs (e.g., with the touch input processing unit 1218).

In some embodiments, the sequence of touch inputs at least partially overlaps at least one of the one or more displayed views of the second software application.

In some embodiments, the processing unit 1206 is configured to enable display of the first set of one or more views without displaying any view of the first software application (e.g., with the display enabling unit 1210, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to enable display of the first set of one or more views without displaying a view of any other software application (e.g., with the display enabling unit 1210, on the touch-sensitive display unit 1202).

In some embodiments, prior to the determination that at least one gesture recognizer in the first set of one or more gesture recognizers recognizes the first portion of one or more touch inputs, the processing unit 1206 is configured to concurrently deliver the first portion of one or more touch inputs to the first software application and the second software application (e.g., with the delivering unit 1216).

In some embodiments, the first software application is an application launcher.

In some embodiments, the first software application is an operating system application.

In some embodiments, the processing unit 1206 is configured to process the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers by enabling displaying one or more views of the first software application (e.g., with the display enabling unit 1208, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to process the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers by replacing the display of the first set of one or more views with display of one or more views of the first software application (e.g., with the display enabling unit 1208, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to concurrently execute the first software application, the second software application, and a third software application (e.g., with the executing unit 1208). The processing unit 1206 is configured to process the sequence of touch inputs with the at least one gesture recognizer in the first set of one or more gesture recognizers by replacing the first set of one or more views with one or more views of the third software application (e.g., with the display enabling unit 1210, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to: enable display of in a first predefined area of the touch-sensitive display unit 1202 a group of open application icons that correspond to at least some of a plurality of concurrently open applications (e.g., with the display enabling unit 1210); and concurrently display at least a subset of the first set of one or more views (e.g., with the display enabling unit 1210).

In accordance with some embodiments, FIG. 13 shows a functional block diagram of an electronic device 1300 configured in accordance with the principles of the invention as described above. The functional blocks of the device may be implemented by hardware, software, or a combination of hardware and software to carry out the principles of the invention. It is understood by persons of skill in the art that the functional blocks described in FIG. 13 may be combined or separated into sub-blocks to implement the principles of the invention as described above. Therefore, the description herein may support any possible combination or separation or further definition of the functional blocks described herein.

As shown in FIG. 13, an electronic device 1300 includes a display unit 1302 configured to display one or more views; a memory unit 1304 configured to store an internal state; and a processing unit 1306 coupled to the display unit 1302 and the memory unit 1304. In some embodiments, the processing unit 1306 includes an executing unit 1308, a display enabling unit 1310, a detecting unit 1312, an identifying unit 1314, a delivering unit 1316, and an event/sub-event processing unit 1318. In some embodiments, the processing unit 1306 includes the memory unit 1304.

The processing unit 1306 is configured to: execute software that includes a view hierarchy with a plurality of views (e.g., with the executing unit 1308); enable display of one or more views of the view hierarchy (e.g., with the display enabling unit 1310, on the display unit 1302); and execute one or more software elements (e.g., with the executing unit 1308). Each software element is associated with a particular view, and each particular view includes one or more event recognizers. Each event recognizer has: one or more event definitions based on one or more sub-events, and an event handler. The event handler specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions. The processing unit 1306 is configured to: detect a sequence of one or more sub-events (e.g., with the detecting unit 1312); and identify one of the views of the view hierarchy as a hit view (e.g., with the identifying unit 1314). The hit view establishes which views in the view hierarchy are actively involved views. The processing unit 1306 is configured to deliver a respective sub-event to event recognizers for each actively involved view within the view hierarchy (e.g., with the delivering unit 1316). At least one event recognizer for actively involved views in the view hierarchy has a plurality of event definitions, one of which is selected in accordance with the internal state of the electronic device, and the at least one event recognizer processes the respective sub-event (e.g., with the event/sub-event processing unit 1318) prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition.

In some embodiments, the plurality of event definitions includes a first event definition corresponding to a first swipe gesture with a first number of fingers and a second event definition corresponding to a second swipe gesture with a second number of fingers distinct from the first number of fingers.

In some embodiments, the internal state includes one or more settings for an accessibility operating mode.

In some embodiments, a respective definition of the plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to an event definition of any event recognizer for the actively involved views other than the respective event recognizer.

In some embodiments, two or more event recognizers for actively involved views in the view hierarchy each have a respective plurality of event definitions, and a respective event definition of the respective plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to any event definition selected for any event recognizer with two or more event definitions other than the respective event recognizer.

In some embodiments, the processing unit 1306 is configured to process the respective sub-event in accordance with the selected event definition by enabling display of one or more views of a first software application distinct from the software that includes the view hierarchy (e.g., with the display enabling unit 1310, on the display unit 1302).

In some embodiments, the processing unit 1306 is configured to process the respective sub-event by replacing the display of the one or more views of the view hierarchy with display of one or more views of a first software application distinct from the software that includes the view hierarchy (e.g., with the display enabling unit 1310, on the display unit 1302).

In some embodiments, the processing unit 1306 is configured to process the respective sub-event by: enabling display of, in a first predefined area of the display unit 1302, a group of open application icons that correspond to at least some of a plurality of concurrently open applications (e.g., with the display enabling unit 1310); and enabling concurrently display of at least a subset of the one or more views of the view hierarchy (e.g., with the display enabling unit 1310).

In some embodiments, the software is an application launcher.

In some embodiments, the software is an operating system application.

The foregoing description, for purpose of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain the principles of the invention and its practical applications, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. 

What is claimed is:
 1. A method, comprising: at an electronic device with an internal state, the electronic device configured to execute software that includes a view hierarchy with a plurality of views: displaying one or more views of the view hierarchy; executing one or more software elements, each software element being associated with a particular view that includes one or more event recognizers, each event recognizer having: one or more event definitions based on one or more sub-events, and an event handler, wherein the event handler: specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions; detecting a sequence of one or more sub-events; identifying a respective view of the view hierarchy as a hit view, wherein the hit view establishes which views in the view hierarchy are actively involved views; and delivering a respective sub-event to an event recognizer for the respective view, wherein the respective view has a plurality of event definitions for a respective event, one of which is selected in accordance with the internal state of the electronic device, and the respective event recognizer processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition, including: sending an action to a respective target in response to the event recognizer detecting an event corresponding to a first event definition of the plurality of event definitions when the first event definition has been selected in accordance with the internal state of the electronic device, and sending an action to the same respective target in response to the event recognizer detecting an event corresponding to a second event definition, distinct from the first event definition, of the plurality of event definitions when the second event definition has been selected in accordance with the internal state of the electronic device.
 2. The method of claim 1, wherein the plurality of event definitions includes a first event definition corresponding to a first swipe gesture with a first number of fingers and a second event definition corresponding to a second swipe gesture with a second number of fingers distinct from the first number of fingers.
 3. The method of claim 1, wherein the internal state includes one or more settings for an accessibility operating mode.
 4. The method of claim 1, wherein a respective definition of the plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to an event definition of any event recognizer for the actively involved views other than the respective event recognizer.
 5. The method of claim 1, wherein two or more event recognizers for the actively involved views in the view hierarchy each have a respective plurality of event definitions, and a respective event definition of the respective plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to any event definition selected for any event recognizer with two or more event definitions other than the respective event recognizer.
 6. The method of claim 1, wherein processing the respective sub-event in accordance with the selected event definition includes displaying one or more views of a first software application distinct from the software that includes the view hierarchy.
 7. The method of claim 1, wherein the respective event recognizer processes the respective sub-event by replacing the display of the one or more views of the view hierarchy with display of one or more views of a first software application distinct from the software that includes the view hierarchy.
 8. The method of claim 1, wherein the respective event recognizer processes the respective sub-event by: displaying in a first predefined area of a display in the electronic device a group of open application icons that correspond to at least some of a plurality of concurrently open applications; and concurrently displaying at least a subset of the one or more views of the view hierarchy.
 9. The method of claim 1, wherein the software is an application launcher.
 10. The method of claim 1, wherein the software is an operating system application.
 11. The method of claim 1, wherein: when a first event definition is selected for a respective event recognizer in accordance with the internal state of the electronic device, the event recognizer is configured to recognize a first sequence of one or more sub-events that corresponds to the first event definition and the event recognizer is not configured to recognize a second sequence of one or more sub-events, distinct from the first sequence of one or more sub-events, that does not correspond to the first event definition; and when a second event definition, distinct from the first event definition, is selected for the respective event recognizer in accordance with the internal state of the electronic device, the event recognizer is configured to recognize the second sequence of one or more sub-events that corresponds to the second event definition and the event recognizer is not configured to recognize the first sequence of one or more sub-events.
 12. The method of claim 1, including: displaying two or more views of the view hierarchy; executing two or more software elements, each software element being associated with a particular view, wherein each particular view includes one or more event recognizers of a plurality of distinct event recognizers, each event recognizer of the plurality of distinct event recognizers having: one or more event definitions based on a sequence of sub-events, and an event handler, wherein the event handler: specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions.
 13. The method of claim 1, wherein the internal state of the electronic device is identified prior to detecting any sub-event of the sequence of one or more sub-events.
 14. An electronic device, comprising: a display; one or more processors; and memory storing an internal state and one or more programs for execution by the one or more processors, the one or more programs including software that includes a view hierarchy with a plurality of views, wherein the one or more programs include instructions for: displaying one or more views of the view hierarchy; executing one or more software elements, each software element being associated with a particular view that includes one or more event recognizers, each event recognizer having: one or more event definitions based on one or more sub-events, and an event handler, wherein the event handler: specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions; detecting a sequence of one or more sub-events; identifying a respective view of the view hierarchy as a hit view, wherein the hit view establishes which views in the view hierarchy are actively involved views; and delivering a respective sub-event to an event recognizer for the respective view, wherein the respective view has a plurality of event definitions for a respective event, one of which is selected in accordance with the internal state of the electronic device, and the respective event recognizer processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition, including: sending an action to a respective target in response to the event recognizer detecting an event corresponding to a first event definition of the plurality of event definitions when the first event definition has been selected in accordance with the internal state of the electronic device, and sending an action to the same respective target in response to the event recognizer detecting an event corresponding to a second event definition, distinct from the first event definition, of the plurality of event definitions when the second event definition has been selected in accordance with the internal state of the electronic device.
 15. The electronic device of claim 14, wherein the plurality of event definitions includes a first event definition corresponding, to a first swipe gesture with a first number of fingers and a second event definition corresponding to a second swipe gesture with a second number of fingers distinct from the first number of fingers.
 16. The electronic device of claim 14, wherein a respective definition of the plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to an event definition of any event recognizer for the actively involved views other than the respective event recognizer.
 17. The electronic device of claim 14, wherein two or more event recognizers for the actively involved views in the view hierarchy each have a respective plurality of event definitions, and a respective event definition of the respective plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to any event definition selected for any event recognizer with two or more event definitions other than the respective event recognizer.
 18. The electronic device of claim 14, wherein the instructions for processing the respective sub-event include instructions for replacing the display of the one or more views of the view hierarchy with display of one or more views of a first software application distinct from the software that includes the view hierarchy.
 19. The electronic device of claim 14, wherein: when a first event definition is selected for a respective event recognizer in accordance with the internal state of the electronic device, the event recognizer is configured to recognize a first sequence of one or more sub-events that corresponds to the first event definition and the event recognizer is not configured to recognize a second sequence of one or more sub-events, distinct from the first sequence of one or more sub-events, that does not correspond to the first event definition; and when a second event definition, distinct from the first event definition, is selected for the respective event recognizer in accordance with the internal state of the electronic device, the event recognizer is configured to recognize the second sequence of one or more sub-events that corresponds to the second event definition and the event recognizer is not configured to recognize the first sequence of one or more sub-events.
 20. The electronic device of claim 14, wherein the one or more programs include instructions for: displaying two or more views of the view hierarchy; executing two or more software elements, each software element being associated with a particular view, wherein each particular view includes one or more event recognizers of a plurality of distinct event recognizers, each event recognizer of the plurality of distinct event recognizers having: one or more event definitions based on a sequence of sub-events, and an event handler, wherein the event handler: specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions.
 21. A non-transitory computer readable storage medium storing one or more programs for execution by one or more processors in an electronic device that has an internal state, the one or more programs including software that includes a view hierarchy with a plurality of views, wherein the one or more programs include instructions for: displaying one or more views of the view hierarchy; executing one or more software elements, each software element being associated with a particular view that includes one or more event recognizers, each event recognizer having: one or more event definitions based on one or more sub-events, and an event handler, wherein the event handler: specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions; detecting a sequence of one or more sub-events; identifying a respective view of the view hierarchy as a hit view, wherein the hit view establishes which views in the view hierarchy are actively involved views; and delivering a respective sub-event to an event recognizer for the respective view, wherein the respective view has a plurality of event definitions for a respective event, one of which is selected in accordance with the internal state of the electronic device, and the respective event recognizer processes the respective sub-event prior to processing a next sub-event in the sequence of sub-events in accordance with the selected event definition, including: sending an action to a respective target in response to the event recognizer detecting an event corresponding to a first event definition of the plurality of event definitions when the first event definition has been selected in accordance with the internal state of the electronic device, and sending an action to the same respective target in response to the event recognizer detecting an event corresponding to a second event definition, distinct from the first event definition, of the plurality of event definitions when the second event definition has been selected in accordance with the internal state of the electronic device.
 22. The computer readable storage medium of claim 21, wherein the plurality of event definitions includes a first event definition corresponding to a first swipe gesture with a first number of fingers and a second event definition corresponding to a second swipe gesture with a second number of fingers distinct from the first number of fingers.
 23. The computer readable storage medium of claim 21, wherein a respective definition of the plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to an event definition of any event recognizer for the actively involved views other than the respective event recognizer.
 24. The computer readable storage medium of claim 21, wherein two or more event recognizers for the actively involved views in the view hierarchy each have a respective plurality of event definitions, and a respective event definition of the respective plurality of event definitions is selected for a respective event recognizer in accordance with the internal state of the electronic device and a determination that the respective event definition does not correspond to any event definition selected for any event recognizer with two or more event definitions other than the respective event recognizer.
 25. The computer readable storage medium of claim 21, wherein the instructions for processing the respective sub-event include instructions for replacing the display of the one or more views of the view hierarchy with display of one or more views of a first software application distinct from the software that includes the view hierarchy.
 26. The computer readable storage medium of claim 21, wherein: when a first event definition is selected for a respective event recognizer in accordance with the internal state of the electronic device, the event recognizer is configured to recognize a first sequence of one or more sub-events that corresponds to the first event definition and the event recognizer is not configured to recognize a second sequence of one or more sub-events, distinct from the first sequence of one or more sub-events, that does not correspond to the first event definition; and when a second event definition, distinct from the first event definition, is selected for the respective event recognizer in accordance with the internal state of the electronic device, the event recognizer is configured to recognize the second sequence of one or more sub-events that corresponds to the second event definition and the event recognizer is not configured to recognize the first sequence of one or more sub-events.
 27. The computer readable storage medium of claim 21, wherein the one or more programs include instructions for: displaying two or more views of the view hierarchy; executing two or more software elements, each software element being associated with a particular view, wherein each particular view includes one or more event recognizers of a plurality of distinct event recognizers, each event recognizer of the plurality of distinct event recognizers having: one or more event definitions based on a sequence of sub-events, and an event handler, wherein the event handler: specifies an action for a target, and is configured to send the action to the target in response to the event recognizer detecting an event corresponding to a particular event definition of the one or more event definitions.
 28. A method, comprising: at an electronic device with an internal state, the electronic device configured to execute software that includes a view hierarchy with a plurality of views: displaying one or more views of the view hierarchy; detecting a sequence of sub-events; delivering a respective sub-event, in the sequence of sub-events, to multiple event recognizers, wherein a respective event recognizer of the multiple event recognizers has a plurality of event definitions for a respective event; selecting one of the plurality of event definitions of the respective event, for the respective event recognizer, in accordance with the internal state of the electronic device; processing the sequence of sub-events, with the respective event recognizer, to determine whether the sequence of sub-events matches the selected event definition, including determining whether the sequence of sub-events matches a first event definition of the plurality of event definitions when the first event definition has been selected for the respective event recognizer in accordance with the internal state of the electronic device and determining whether the sequence of sub-events matches a second event definition, distinct from the first event definition, of the plurality of event definitions when the second event definition has been selected for the respective event recognizer in accordance with the internal state of the electronic device; and, in accordance with a determination that sequence of sub-events matches the selected event definition, activating a respective event handler that corresponds to the respective event recognizer.
 29. An electronic device, comprising: a display; one or more processors; and memory storing an internal state and one or more programs for execution by the one or more processors, the one or more programs including instructions for: displaying one or more views of a view hierarchy, the view hierarchy including a plurality of views; detecting a sequence of sub-events; delivering a respective sub-event, in the sequence of sub-events, to multiple event recognizers, wherein a respective event recognizer of the multiple event recognizers has a plurality of event definitions for a respective event; selecting one of the plurality of event definitions of the respective event, for the respective event recognizer, in accordance with the internal state of the electronic device; processing the sequence of sub-events, with the respective event recognizer, to determine whether the sequence of sub-events matches the selected event definition, including determining whether the sequence of sub-events matches a first event definition of the plurality of event definitions when the first event definition has been selected for the respective event recognizer in accordance with the internal state of the electronic device and determining whether the sequence of sub-events matches a second event definition, distinct from the first event definition, of the plurality of event definitions when the second event definition has been selected for the respective event recognizer in accordance with the internal state of the electronic device; and, in accordance with a determination that sequence of sub-events matches the selected event definition, activating a respective event handler that corresponds to the respective event recognizer.
 30. A non-transitory computer readable storage medium storing one or more programs for execution by one or more processors in an electronic device that has an internal state, the one or more programs including instructions for: displaying one or more views of a view hierarchy, the view hierarchy including a plurality of views; detecting a sequence of sub-events; delivering a respective sub-event, in the sequence of sub-events, to multiple event recognizers, wherein a respective event recognizer of the multiple event recognizers has a plurality of event definitions for a respective event; selecting one of the plurality of event definitions of the respective event, for the respective event recognizer, in accordance with the internal state of the electronic device; processing the sequence of sub-events, with the respective event recognizer, to determine whether the sequence of sub-events matches the selected event definition, including determining whether the sequence of sub-events matches a first event definition of the plurality of event definitions when the first event definition has been selected for the respective event recognizer in accordance with the internal state of the electronic device and determining whether the sequence of sub-events matches a second event definition, distinct from the first event definition, of the plurality of event definitions when the second event definition has been selected for the respective event recognizer in accordance with the internal state of the electronic device; and, in accordance with a determination that sequence of sub-events matches the selected event definition, activating a respective event handler that corresponds to the respective event recognizer. 